Back to index

nux  3.0.0
Public Member Functions | Private Attributes
nux::FontRenderer Class Reference

#include <FontRenderer.h>

Collaboration diagram for nux::FontRenderer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FontRenderer (GraphicsEngine &OpenGLEngine)
 ~FontRenderer ()
int DrawColorString (ObjectPtr< FontTexture > Font, int x, int y, const NString &str, const Color &color, bool WriteAlphaChannel, int NumCharacter=0, int SkipFirstNCharacters=0)
void PositionString (ObjectPtr< FontTexture > Font, const NString &str, const PageBBox &, StringBBox &, TextAlignment align=eAlignTextCenter, int NumCharacter=0)
int RenderColorText (ObjectPtr< FontTexture > Font, int x, int y, const NString &Str, const Color &color, bool WriteAlphaChannel, int NumCharacter)
int RenderColorTextLineStatic (ObjectPtr< FontTexture > Font, const PageBBox &pageSize, const NString &Str, const Color &color, bool WriteAlphaChannel, TextAlignment alignment)
int RenderColorTextLineEdit (ObjectPtr< FontTexture > Font, const PageBBox &pageSize, const NString &Str, const Color &TextColor, bool WriteAlphaChannel, const Color &SelectedTextColor, const Color &SelectedTextBackgroundColor, const Color &TextBlinkColor, const Color &CursorColor, bool ShowCursor, unsigned int CursorPosition, int offset=0, int selection_start=0, int selection_end=0)
int RenderText (ObjectPtr< FontTexture > Font, int x, int y, const NString &str, const Color &color, bool WriteAlphaChannel, int StartCharacter=0, int NumCharacters=0)
int RenderTextToBuffer (float *VertexBuffer, int VBSize, ObjectPtr< FontTexture > Font, Rect geo, const NString &str, const Color &color, TextAlignment alignment=eAlignTextCenter, int NumCharacter=0)

Private Attributes

GraphicsEngine_graphics_engine
ObjectPtr< IOpenGLPixelShader_pixel_shader_prog
ObjectPtr< IOpenGLVertexShader_vertex_shader_prog
ObjectPtr< IOpenGLShaderProgram_shader_prog
ObjectPtr
< IOpenGLAsmShaderProgram
_asm_shader_prog
ObjectPtr
< IOpenGLAsmShaderProgram
_asm_font_texture_rect_prog

Detailed Description

Definition at line 40 of file FontRenderer.h.


Constructor & Destructor Documentation

Definition at line 157 of file FontRenderer.cpp.

  {
  }

Member Function Documentation

int nux::FontRenderer::DrawColorString ( ObjectPtr< FontTexture Font,
int  x,
int  y,
const NString str,
const Color &  color,
bool  WriteAlphaChannel,
int  NumCharacter = 0,
int  SkipFirstNCharacters = 0 
)

Definition at line 161 of file FontRenderer.cpp.

  {
    return RenderText(Font, x, y, str, color, WriteAlphaChannel, SkipFirstNCharacters, NumCharacter);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::FontRenderer::PositionString ( ObjectPtr< FontTexture Font,
const NString str,
const PageBBox pageBBox,
StringBBox strBBox,
TextAlignment  align = eAlignTextCenter,
int  NumCharacter = 0 
)

Definition at line 166 of file FontRenderer.cpp.

  {
    int x, y;
    int xmin, ymin, xmax, ymax;
    xmin = pageBBox.xmin + pageBBox.x_margin;
    xmax = pageBBox.xmax - pageBBox.x_margin;
    ymin = pageBBox.ymin + pageBBox.y_margin;
    ymax = pageBBox.ymax - pageBBox.y_margin;

    int NumChar = 0;

    if (NumCharacter == 0)
      NumChar = str.Size();
    else
      NumChar = Min((int) str.Size(), NumCharacter);

    strBBox.width = Font->GetStringWidth(str, NumChar);
    strBBox.height = Font->GetLineHeight();

    switch(alignment)
    {
      case eAlignTextCenter:

        if (strBBox.width > xmax - xmin)
          x = xmin; // the text is larger than the box: default to eAlignTextLeft for x.
        else
          x = xmin + ((float) (xmax - xmin) - (float) (strBBox.width)) / 2.0f;

        y = ymin + ((float) (ymax - ymin) - (float) (strBBox.height)) / 2.0f;
        break;

      case eAlignTextRight:
        x = xmin + ((float) (xmax - xmin) - (float) (strBBox.width));
        y = ymin + ((float) (ymax - ymin) - (float) (strBBox.height)) / 2.0f;
        break;

      case eAlignTextLeft:
      default:
        x = xmin;
        y = ymin + ((float) (ymax - ymin) - (float) (strBBox.height)) / 2.0f;
        break;
    }

    strBBox.x = x;
    strBBox.y = y;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

int nux::FontRenderer::RenderColorText ( ObjectPtr< FontTexture Font,
int  x,
int  y,
const NString Str,
const Color &  color,
bool  WriteAlphaChannel,
int  NumCharacter 
)

Definition at line 213 of file FontRenderer.cpp.

  {
    int off = DrawColorString(Font, x, y, Str, color, WriteAlphaChannel, 0, NumCharacter);
    return off;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

int nux::FontRenderer::RenderColorTextLineEdit ( ObjectPtr< FontTexture Font,
const PageBBox pageSize,
const NString Str,
const Color &  TextColor,
bool  WriteAlphaChannel,
const Color &  SelectedTextColor,
const Color &  SelectedTextBackgroundColor,
const Color &  TextBlinkColor,
const Color &  CursorColor,
bool  ShowCursor,
unsigned int  CursorPosition,
int  offset = 0,
int  selection_start = 0,
int  selection_end = 0 
)

Definition at line 233 of file FontRenderer.cpp.

  {
    StringBBox stringBBox;
    Color selection_color(0xFF888888);

    NString substring = Str.GetSubString(selection_start, selection_end - selection_start);
    unsigned int substring_width = Font->GetStringWidth(substring);
    int substring_pos = Font->GetStringWidth(Str, selection_start);

    _graphics_engine.PushClippingRectangle(Rect(pageSize.xmin, pageSize.ymin, pageSize.xmax - pageSize.xmin, pageSize.ymax - pageSize.ymin));

    if (substring_width > 0)
      _graphics_engine.QRP_Color(pageSize.xmin + offset + substring_pos, pageSize.ymin, substring_width, pageSize.ymax - pageSize.ymin, SelectedTextBackgroundColor);

    _graphics_engine.PopClippingRectangle();

    _graphics_engine.PushClippingRectangle(Rect(pageSize.xmin, pageSize.ymin, pageSize.xmax - pageSize.xmin, pageSize.ymax - pageSize.ymin));

    PositionString(Font, Str, pageSize, stringBBox, eAlignTextLeft);
    //ComputeGlyphString(stringBBox.x + offset, stringBBox.y, Str.c_str());

    // Part before selected text
    int off = DrawColorString(Font, stringBBox.x + offset, stringBBox.y, Str, TextColor, WriteAlphaChannel, 0, selection_start);
    // Selection part
    off = DrawColorString(Font, stringBBox.x + offset, stringBBox.y, Str, SelectedTextColor, WriteAlphaChannel, selection_start, selection_end - selection_start);
    // Part after selected text
    off = DrawColorString(Font, stringBBox.x + offset, stringBBox.y, Str, TextColor, WriteAlphaChannel, selection_end, Str.Size() - selection_end);

    _graphics_engine.PopClippingRectangle();

    // Render Cursor
    NString temp = Str.GetSubString(0, CursorPosition);
    int w = Font->GetStringWidth(temp.GetTCharPtr());


    if (ShowCursor)
    {
      int x = pageSize.xmin + w + offset + CURSOR_OFFSET;
      x = (x >= pageSize.xmax) ? pageSize.xmax - 1 : x;
      _graphics_engine.PushClippingRectangle(Rect(x, pageSize.ymin, CURSOR_SIZE, pageSize.ymax - pageSize.ymin));

      _graphics_engine.QRP_Color(x, pageSize.ymin, CURSOR_SIZE, pageSize.ymax - pageSize.ymin, CursorColor);
      
      DrawColorString(Font, stringBBox.x + offset, stringBBox.y, Str, TextBlinkColor, WriteAlphaChannel, CursorPosition, 1);
      _graphics_engine.PopClippingRectangle();
    }

    return off;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

int nux::FontRenderer::RenderColorTextLineStatic ( ObjectPtr< FontTexture Font,
const PageBBox pageSize,
const NString Str,
const Color &  color,
bool  WriteAlphaChannel,
TextAlignment  alignment 
)

Definition at line 220 of file FontRenderer.cpp.

  {
    StringBBox stringBBox;

    _graphics_engine.PushClippingRectangle(Rect(pageSize.xmin, pageSize.ymin, pageSize.xmax - pageSize.xmin, pageSize.ymax - pageSize.ymin));
    PositionString(Font, Str, pageSize, stringBBox, alignment);
    int off = DrawColorString(Font, stringBBox.x, stringBBox.y, Str, color, WriteAlphaChannel, 0, Str.Size());

    _graphics_engine.PopClippingRectangle();
    return off;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

int nux::FontRenderer::RenderText ( ObjectPtr< FontTexture Font,
int  x,
int  y,
const NString str,
const Color &  color,
bool  WriteAlphaChannel,
int  StartCharacter = 0,
int  NumCharacters = 0 
)

Definition at line 290 of file FontRenderer.cpp.

  {
    // !WARNING This call works if all the glyph of the font are in a single texture.

    int StrLength = str.Size();

    if (StrLength <= 0)
      return 0;

    nuxAssertMsg(NumCharacter >= 0, "[FontRenderer::RenderText] Incorrect value for NumCharacter.");
    nuxAssertMsg(StartCharacter >= 0, "[FontRenderer::RenderText] Incorrect value for StartCharacter.");
    nuxAssertMsg(StartCharacter <= StrLength, "[FontRenderer::RenderText] Incorrect value for StartCharacter.");

    //     if (NumCharacter == 0)
    //         NumCharacter = str.Size();

    int NumCharToDraw = Min<int> (StrLength - StartCharacter, NumCharacter);

    //nuxAssertMsg(NumCharToDraw > 0, "[FontRenderer::RenderText] Incorrect value for NumCharToDraw.");
    if (NumCharToDraw <= 0)
      return 0;

    CHECKGL(glDisable(GL_CULL_FACE));
    int CurX = x;
    int CurY = y;
    _graphics_engine.GetRenderStates().SetBlend(TRUE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    _graphics_engine.GetRenderStates().SetColorMask(TRUE, TRUE, TRUE, WriteAlphaChannel); // Do not write the alpha of characters

    GLshort *Index = new GLshort[StrLength*6];
    Vector4 *Position = new Vector4[StrLength*4];
    Vector4 *UV = new Vector4[StrLength*4];
    Vector4 *Offset = new Vector4[StrLength*4];
    Vector4 *Scale = new Vector4[StrLength*4];

    ObjectPtr<CachedBaseTexture> glTexture = _graphics_engine.ResourceCache.GetCachedResource(Font->TextureArray[0]);

    float tex_width = (float) glTexture->m_Texture->GetWidth();
    float tex_height = (float) glTexture->m_Texture->GetHeight();

    for (int i = 0; i < StrLength; ++i)
    {
      unsigned char c = static_cast<unsigned char> (str[i]);
      unsigned int CharX = Font->m_Charset.Chars[c /*Str[i]*/].x;
      unsigned int CharY = Font->m_Charset.Chars[c /*Str[i]*/].y;
      unsigned int Width = Font->m_Charset.Chars[c /*Str[i]*/].Width;
      unsigned int Height = Font->m_Charset.Chars[c /*Str[i]*/].Height;
      //int OffsetX = Font->m_Charset.Chars[c /*Str[i]*/].XOffset;
      //int OffsetY = Font->m_Charset.Chars[c /*Str[i]*/].YOffset;
      int abcA = Font->m_Charset.Chars[c /*Str[i]*/].abcA;
      int abcB = Font->m_Charset.Chars[c /*Str[i]*/].abcB;
      int abcC = Font->m_Charset.Chars[c /*Str[i]*/].abcC;
      //int page = Font->m_Charset.Chars[c /*Str[i]*/].page;

      if ((i >= StartCharacter) && (i < StartCharacter + NumCharToDraw))
      {
        int II = i - StartCharacter;
        Position[II*4 + 0].x = 0;      // x
        Position[II*4 + 0].y = 0;      // y
        Position[II*4 + 0].z = 0;      // z
        Position[II*4 + 0].w = 1.0f;   // w

        Position[II*4 + 1].x = 1.0f;   // x
        Position[II*4 + 1].y = 0;      // y
        Position[II*4 + 1].z = 0;      // z
        Position[II*4 + 1].w = 1;      // w

        Position[II*4 + 2].x = 1.0f;   // x
        Position[II*4 + 2].y = 1.0f;   // y
        Position[II*4 + 2].z = 0;      // z
        Position[II*4 + 2].w = 1;      // w

        Position[II*4 + 3].x = 0;      // x
        Position[II*4 + 3].y = 1.0f;   // y
        Position[II*4 + 3].z = 0;      // z
        Position[II*4 + 3].w = 1;      // w

        for (int j = 0; j < 4; j++)
        {
          Offset[II*4 + j].x = CurX + abcA;
          Offset[II*4 + j].y = CurY;
          Offset[II*4 + j].z = 0.0f;
          Offset[II*4 + j].w = 0.0f;

          Scale[II*4 + j].x = Width;
          Scale[II*4 + j].y = Height;
          Scale[II*4 + j].z = 1.0f;
          Scale[II*4 + j].w = 1.0f;
        }

        if (glTexture->m_Texture->Type().IsDerivedFromType(IOpenGLRectangleTexture::StaticObjectType))
        {
          //upper left
          UV[II*4 + 0].x = CharX;
          UV[II*4 + 0].y = CharY;
          UV[II*4 + 0].z = 0.0f;
          UV[II*4 + 0].w = 0.0f;

          //upper right
          UV[II*4 + 1].x = (CharX + Width);
          UV[II*4 + 1].y = CharY;
          UV[II*4 + 1].z = 0.0f;
          UV[II*4 + 1].w = 0.0f;

          //lower right
          UV[II*4 + 2].x = (CharX + Width);
          UV[II*4 + 2].y = (CharY + Height);
          UV[II*4 + 2].z = 0.0f;
          UV[II*4 + 2].w = 0.0f;

          //lower left
          UV[II*4 + 3].x = CharX;
          UV[II*4 + 3].y = (CharY + Height);
          UV[II*4 + 3].z = 0.0f;
          UV[II*4 + 3].w = 0.0f;
        }
        else
        {
          //upper left
          UV[II*4 + 0].x = CharX / tex_width;
          UV[II*4 + 0].y = CharY / tex_height;
          UV[II*4 + 0].z = 0.0f;
          UV[II*4 + 0].w = 0.0f;

          //upper right
          UV[II*4 + 1].x = (CharX + Width) / tex_width;
          UV[II*4 + 1].y = CharY / tex_height;
          UV[II*4 + 1].z = 0.0f;
          UV[II*4 + 1].w = 0.0f;

          //lower right
          UV[II*4 + 2].x = (CharX + Width) / tex_width;
          UV[II*4 + 2].y = (CharY + Height) / tex_height;
          UV[II*4 + 2].z = 0.0f;
          UV[II*4 + 2].w = 0.0f;

          //lower left
          UV[II*4 + 3].x = CharX / tex_width;
          UV[II*4 + 3].y = (CharY + Height) / tex_height;
          UV[II*4 + 3].z = 0.0f;
          UV[II*4 + 3].w = 0.0f;
        }
      }

      // Set up element array indices
      Index[i*6 + 0] = i*4;
      Index[i*6 + 1] = i*4 + 2;
      Index[i*6 + 2] = i*4 + 3;

      Index[i*6 + 3] = i*4;
      Index[i*6 + 4] = i*4 + 1;
      Index[i*6 + 5] = i*4 + 2;

      CurX += abcA + abcB + abcC;
    }

    CHECKGL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0));
    CHECKGL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0));

    int in_attrib_position = 0;
    int in_attrib_tex_uv = 0;
    int in_attrib_scale = 0;
    int in_attrib_offset = 0;

    ObjectPtr<IOpenGLAsmShaderProgram> shader_program;
    if (_graphics_engine.UsingGLSLCodePath())
    {
      _shader_prog->Begin();
      int ViewProjectionMatrix = _shader_prog->GetUniformLocationARB("ViewProjectionMatrix");
      Matrix4 mat = _graphics_engine.GetOpenGLModelViewProjectionMatrix();

      _shader_prog->SetUniformLocMatrix4fv(ViewProjectionMatrix, 1, false, (float *) &mat);

      in_attrib_position = _shader_prog->GetAttributeLocation("_Position");
      in_attrib_tex_uv   = _shader_prog->GetAttributeLocation("iTexUV");
      in_attrib_scale    = _shader_prog->GetAttributeLocation("iScale");
      in_attrib_offset   = _shader_prog->GetAttributeLocation("iOffset");

      int FontTexture    = _shader_prog->GetUniformLocationARB("FontTexture");
      int TextColor      = _shader_prog->GetUniformLocationARB("TextColor");

      _graphics_engine.SetTexture(GL_TEXTURE0, glTexture->m_Texture);

      if (FontTexture != -1)
      {
        CHECKGL(glUniform1iARB(FontTexture, 0));
      }

      if (TextColor != -1)
      {
        CHECKGL(glUniform4fARB(TextColor, color.red, color.green, color.blue, color.alpha));
      }
    }
#ifndef NUX_OPENGLES_20
    else
    {
      shader_program = _asm_shader_prog;
      if (glTexture->m_Texture->Type().IsDerivedFromType(IOpenGLRectangleTexture::StaticObjectType))
      {
        shader_program = _asm_font_texture_rect_prog;
      }
      shader_program->Begin();

      CHECKGL(glMatrixMode(GL_MODELVIEW));
      CHECKGL(glLoadIdentity());
      Matrix4 model_view_matrix = _graphics_engine.GetModelViewMatrix();
      model_view_matrix.Transpose();
      CHECKGL(glLoadMatrixf((float *) model_view_matrix.m));

      CHECKGL(glMatrixMode(GL_PROJECTION));
      CHECKGL(glLoadIdentity());
      Matrix4 projection_matrix = GetGraphicsDisplay()->GetGraphicsEngine()->GetProjectionMatrix();
      projection_matrix.Transpose();
      CHECKGL(glLoadMatrixf((float *) projection_matrix.m));

      in_attrib_position   = VTXATTRIB_POSITION;
      in_attrib_tex_uv      = VTXATTRIB_TEXCOORD0;
      in_attrib_scale      = VTXATTRIB_TEXCOORD1;
      in_attrib_offset     = VTXATTRIB_TEXCOORD2;

      CHECKGL(glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, color.red, color.green, color.blue, color.alpha ));

      _graphics_engine.SetTexture(GL_TEXTURE0, glTexture->m_Texture);
    }
#endif

    if (in_attrib_offset != -1)
    {
      CHECKGL(glEnableVertexAttribArrayARB(in_attrib_offset));
      CHECKGL(glVertexAttribPointerARB(in_attrib_offset, 4, GL_FLOAT, GL_FALSE, 16, Offset));
    }

    if (in_attrib_position != -1)
    {
      CHECKGL(glEnableVertexAttribArrayARB(in_attrib_position));
      CHECKGL(glVertexAttribPointerARB(in_attrib_position, 4, GL_FLOAT, GL_FALSE, 16, Position));
    }

    if (in_attrib_scale != -1)
    {
      CHECKGL(glEnableVertexAttribArrayARB(in_attrib_scale));
      CHECKGL(glVertexAttribPointerARB(in_attrib_scale, 4, GL_FLOAT, GL_FALSE, 16, Scale));
    }

    if (in_attrib_tex_uv != -1)
    {
      CHECKGL(glEnableVertexAttribArrayARB(in_attrib_tex_uv));
      CHECKGL(glVertexAttribPointerARB(in_attrib_tex_uv, 4, GL_FLOAT, GL_FALSE, 16, UV));
    }

    if (NumCharToDraw > 0)
      CHECKGL(glDrawElements( GL_TRIANGLES, NumCharToDraw * 6, GL_UNSIGNED_SHORT, Index ));

    if (in_attrib_position != -1)
      CHECKGL(glDisableVertexAttribArrayARB(in_attrib_position));

    if (in_attrib_offset != -1)
      CHECKGL(glDisableVertexAttribArrayARB(in_attrib_offset));

    if (in_attrib_scale != -1)
      CHECKGL(glDisableVertexAttribArrayARB(in_attrib_scale));

    if (in_attrib_tex_uv != -1)
      CHECKGL(glDisableVertexAttribArrayARB(in_attrib_tex_uv));

    if (_graphics_engine.UsingGLSLCodePath())
    {
      _shader_prog->End();
    }
    else
    {
      shader_program->End();
    }

    _graphics_engine.GetRenderStates().SetColorMask(TRUE, TRUE, TRUE, TRUE);
    _graphics_engine.GetRenderStates().SetBlend(FALSE);

    CurX -= x + CURSOR_OFFSET;

    delete [] Index;
    delete [] Position;
    delete [] UV;
    delete [] Scale;
    delete [] Offset;

    return CurX; // number of pixel to offset before writing the next string.
  }

Here is the call graph for this function:

Here is the caller graph for this function:

int nux::FontRenderer::RenderTextToBuffer ( float *  VertexBuffer,
int  VBSize,
ObjectPtr< FontTexture Font,
Rect  geo,
const NString str,
const Color &  color,
TextAlignment  alignment = eAlignTextCenter,
int  NumCharacter = 0 
)

Definition at line 577 of file FontRenderer.cpp.

  {
    nuxAssertMsg(NumCharacter >= 0, "[FontRenderer::RenderTextToBuffer] Number of char to draw must be positive.");
    int NumCharToDraw = 0;

    if (NumCharacter == 0)
      NumCharToDraw = str.Size();
    else
      NumCharToDraw = Min((int) str.Size(), NumCharacter);

    nuxAssertMsg(3 * NumCharToDraw * 16 <= VBSize, "[FontRenderer::RenderTextToBuffer] VertexBuffer not large enough.");

    if (3 * NumCharToDraw * 16 > VBSize)
      return 0;

    StringBBox stringBBox;
    PageBBox pageBox;
    pageBox.xmin = geo.x;
    pageBox.xmax = geo.x + geo.GetWidth();
    pageBox.ymin = geo.y;
    pageBox.ymax = geo.y + geo.GetHeight();
    pageBox.x_margin = 0;
    pageBox.y_margin = 0;

    PositionString(Font, str, pageBox, stringBBox, alignment);

    int CurX = stringBBox.x;
    int CurY = stringBBox.y;

    Vector4 *Position = (Vector4 *) VertexBuffer;

    for (int i = 0; i < NumCharToDraw; ++i)
    {
      unsigned char c = static_cast<unsigned char> (str[i]);
      unsigned int CharX = Font->m_Charset.Chars[c /*Str[i]*/].x;
      unsigned int CharY = Font->m_Charset.Chars[c /*Str[i]*/].y;
      unsigned int Width = Font->m_Charset.Chars[c /*Str[i]*/].Width;
      unsigned int Height = Font->m_Charset.Chars[c /*Str[i]*/].Height;
      //int OffsetX = Font->m_Charset.Chars[c /*Str[i]*/].XOffset;
      //int OffsetY = Font->m_Charset.Chars[c /*Str[i]*/].YOffset;
      int abcA = Font->m_Charset.Chars[c /*Str[i]*/].abcA;
      int abcB = Font->m_Charset.Chars[c /*Str[i]*/].abcB;
      int abcC = Font->m_Charset.Chars[c /*Str[i]*/].abcC;
      //int page = Font->m_Charset.Chars[c /*Str[i]*/].page;

      // Position upper left
      //                            Scale       Offset
      Position[i*12 + 0].x = 0.0f  * Width     + (CurX + abcA);    // x
      Position[i*12 + 0].y = 0.0f  * Height    + (CurY);           // y
      Position[i*12 + 0].z = 0.0f  * 1.0f      + 0.0f;             // z
      Position[i*12 + 0].w = 1.0f  * 1.0f      + 0.0f;             // w
      // texture coord
      Position[i*12 + 1].x = CharX;
      Position[i*12 + 1].y = CharY;
      Position[i*12 + 1].z = 0.0f;
      Position[i*12 + 1].w = 1.0f;
      // color
      Position[i*12 + 2].x = color.red;
      Position[i*12 + 2].y = color.green;
      Position[i*12 + 2].z = color.blue;
      Position[i*12 + 2].w = color.alpha;

      // Position lower left
      Position[i*12 + 9].x = 0.0f  * Width     + (CurX + abcA);    // x
      Position[i*12 + 9].y = 1.0f  * Height    + (CurY);           // y
      Position[i*12 + 9].z = 0.0f  * 1.0f      + 0.0f;             // z
      Position[i*12 + 9].w = 1.0f  * 1.0f      + 0.0f;             // w
      // texture coord
      Position[i*12 + 10].x = CharX;
      Position[i*12 + 10].y = CharY + Height;
      Position[i*12 + 10].z = 0.0f;
      Position[i*12 + 10].w = 1.0f;
      // color
      Position[i*12 + 11].x = color.red;
      Position[i*12 + 11].y = color.green;
      Position[i*12 + 11].z = color.blue;
      Position[i*12 + 11].w = color.alpha;

      // Position lower right
      Position[i*12 + 6].x = 1.0f  * Width     + (CurX + abcA);    // x
      Position[i*12 + 6].y = 1.0f  * Height    + (CurY);           // y
      Position[i*12 + 6].z = 0.0f  * 1.0f      + 0.0f;             // z
      Position[i*12 + 6].w = 1.0f  * 1.0f      + 0.0f;             // w
      // texture coord
      Position[i*12 + 7].x = CharX + Width;
      Position[i*12 + 7].y = CharY + Height;
      Position[i*12 + 7].z = 0.0f;
      Position[i*12 + 7].w = 1.0f;
      // color
      Position[i*12 + 8].x = color.red;
      Position[i*12 + 8].y = color.green;
      Position[i*12 + 8].z = color.blue;
      Position[i*12 + 8].w = color.alpha;

      // Position upper right
      Position[i*12 + 3].x = 1.0f  * Width     + (CurX + abcA);    // x
      Position[i*12 + 3].y = 0.0f  * Height    + (CurY);           // y
      Position[i*12 + 3].z = 0.0f  * 1.0f      + 0.0f;             // z
      Position[i*12 + 3].w = 1.0f  * 1.0f      + 0.0f;             // w
      // texture coord
      Position[i*12 + 4].x = CharX + Width;
      Position[i*12 + 4].y = CharY;
      Position[i*12 + 4].z = 0.0f;
      Position[i*12 + 4].w = 1.0f;
      // color
      Position[i*12 + 5].x = color.red;
      Position[i*12 + 5].y = color.green;
      Position[i*12 + 5].z = color.blue;
      Position[i*12 + 5].w = color.alpha;

      CurX += abcA + abcB + abcC;
    }

    CurX -= stringBBox.x + CURSOR_OFFSET;
    return NumCharToDraw;
  }

Here is the call graph for this function:


Member Data Documentation

Definition at line 76 of file FontRenderer.h.

Definition at line 74 of file FontRenderer.h.

Definition at line 67 of file FontRenderer.h.

Definition at line 68 of file FontRenderer.h.

Definition at line 70 of file FontRenderer.h.

Definition at line 69 of file FontRenderer.h.


The documentation for this class was generated from the following files: