Пример #1
0
void TextBase :: renderLine(const wchar_t*line, float dist) {
  float x1=0, y1=0, z1=0, x2=0, y2=0, z2=0;
  m_font->BBox(line, x1, y1, z1, x2, y2, z2); // FTGL

  glPushMatrix();
  glNormal3f(0.0, 0.0, 1.0);
  justifyFont(x1, y1, z1, x2, y2, z2, dist);
  m_font->Render(line);
  glPopMatrix();
}
Пример #2
0
void TextBase :: renderLine(const wchar_t*line, float dist) {
  float x1=0, y1=0, z1=0, x2=0, y2=0, z2=0;
  m_font->BBox(line, x1, y1, z1, x2, y2, z2); // FTGL

  glPushMatrix();
  glNormal3f(0.0, 0.0, 1.0);

  Justification just=justifyFont(x1, y1, z1, x2, y2, z2, dist);
  glScalef(just.scale, just.scale, just.scale);
  glTranslatef(-just.width, -just.height, -just.depth);

  m_font->Render(line);
  glPopMatrix();
}
Пример #3
0
void TextBase :: getBBox()
{
  if(!m_font || m_theText.empty())
    return;

  std::vector<gem::any>atoms;
  float x0, y0, z0, x1, y1, z1;
  x0 = y0 = z0 =  x1 = y1 = z1 = 0.f;

  for(int i=0; i<m_theText.size(); i++) {
    float _x0, _y0, _z0, _x1, _y1, _z1;
    float dist =  m_lineDist[i]*m_fontSize*m_dist*m_precision;
    m_font->BBox(m_theText[i].c_str(), _x0, _y0, _z0, _x1, _y1, _z1);
    Justification just=justifyFont(_x0, _y0, _z0, _x1, _y1, _z1, dist);
#define JUST(var, offset) var = (var - offset) * just.scale
    JUST(_x0, just.width);  JUST(_x1, just.width);
    JUST(_y0, just.height); JUST(_y1, just.height);
    JUST(_z0, just.depth);  JUST(_z1, just.depth);

    atoms.clear();
    atoms.push_back(i);
    atoms.push_back(_x0);
    atoms.push_back(_y0);
    atoms.push_back(_z0);
    atoms.push_back(_x1);
    atoms.push_back(_y1);
    atoms.push_back(_z1);
    m_infoOut.send("bboxline", atoms);

    // get the bounding box for all lines
    x0 = MIN(x0, _x0);  x1 = MAX(x1, _x1);
    y0 = MIN(y0, _y0);  y1 = MAX(y1, _y1);
    z0 = MIN(z0, _z0);  z1 = MAX(z1, _z1);
  }
  atoms.clear();
  atoms.push_back(x0);
  atoms.push_back(y0);
  atoms.push_back(z0);
  atoms.push_back(x1);
  atoms.push_back(y1);
  atoms.push_back(z1);
  m_infoOut.send("bbox", atoms);


}
Пример #4
0
////////////////////////////////////////////////////////
// render
//
/////////////////////////////////////////////////////////
void TextBase :: renderLine(const char*line, float dist) {
  float x1=0, y1=0, z1=0, x2=0, y2=0, z2=0;
#if 0
  startpost("renderline: "); {
    const char*c=line;
    while(c) {
      startpost("%c (%x)", c, c);
      c++;
    }
  }
#endif
  m_font->BBox(line, x1, y1, z1, x2, y2, z2); // FTGL

  glPushMatrix();
  glNormal3f(0.0, 0.0, 1.0);
  justifyFont(x1, y1, z1, x2, y2, z2, dist);
  m_font->Render(line);
  glPopMatrix();
}