diff options
Diffstat (limited to 'src/engine/client/text.cpp')
| -rw-r--r-- | src/engine/client/text.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index e3509143..df28283d 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -35,7 +35,7 @@ static int aFontSizes[] = {8,9,10,11,12,13,14,15,16,17,18,19,20,36,64}; struct CFontChar { - int m_Id; + int m_ID; // these values are scaled to the pFont size // width * font_size == real_size @@ -244,10 +244,10 @@ class CTextRender : public IEngineTextRender } - void UploadGlyph(CFontSizeData *pSizeData, int Texnum, int SlotId, int Chr, const void *pData) + void UploadGlyph(CFontSizeData *pSizeData, int Texnum, int SlotID, int Chr, const void *pData) { - int x = (SlotId%pSizeData->m_NumXChars) * (pSizeData->m_TextureWidth/pSizeData->m_NumXChars); - int y = (SlotId/pSizeData->m_NumXChars) * (pSizeData->m_TextureHeight/pSizeData->m_NumYChars); + int x = (SlotID%pSizeData->m_NumXChars) * (pSizeData->m_TextureWidth/pSizeData->m_NumXChars); + int y = (SlotID/pSizeData->m_NumXChars) * (pSizeData->m_TextureHeight/pSizeData->m_NumYChars); glBindTexture(GL_TEXTURE_2D, pSizeData->m_aTextures[Texnum]); glTexSubImage2D(GL_TEXTURE_2D, 0, x, y, @@ -293,7 +293,7 @@ class CTextRender : public IEngineTextRender int RenderGlyph(CFont *pFont, CFontSizeData *pSizeData, int Chr) { FT_Bitmap *pBitmap; - int SlotId = 0; + int SlotID = 0; int SlotW = pSizeData->m_TextureWidth / pSizeData->m_NumXChars; int SlotH = pSizeData->m_TextureHeight / pSizeData->m_NumYChars; int SlotSize = SlotW*SlotH; @@ -312,8 +312,8 @@ class CTextRender : public IEngineTextRender pBitmap = &pFont->m_FtFace->glyph->bitmap; // ignore_convention // fetch slot - SlotId = GetSlot(pSizeData); - if(SlotId < 0) + SlotID = GetSlot(pSizeData); + if(SlotID < 0) return -1; // adjust spacing @@ -345,12 +345,12 @@ class CTextRender : public IEngineTextRender ms_aGlyphData[py*SlotW+px] = 255; // upload the glyph - UploadGlyph(pSizeData, 0, SlotId, Chr, ms_aGlyphData); + UploadGlyph(pSizeData, 0, SlotID, Chr, ms_aGlyphData); if(OutlineThickness == 1) { Grow(ms_aGlyphData, ms_aGlyphDataOutlined, SlotW, SlotH); - UploadGlyph(pSizeData, 1, SlotId, Chr, ms_aGlyphDataOutlined); + UploadGlyph(pSizeData, 1, SlotID, Chr, ms_aGlyphDataOutlined); } else { @@ -359,32 +359,32 @@ class CTextRender : public IEngineTextRender Grow(ms_aGlyphData, ms_aGlyphDataOutlined, SlotW, SlotH); Grow(ms_aGlyphDataOutlined, ms_aGlyphData, SlotW, SlotH); } - UploadGlyph(pSizeData, 1, SlotId, Chr, ms_aGlyphData); + UploadGlyph(pSizeData, 1, SlotID, Chr, ms_aGlyphData); } // set char info { - CFontChar *pFontchr = &pSizeData->m_aCharacters[SlotId]; + CFontChar *pFontchr = &pSizeData->m_aCharacters[SlotID]; float Scale = 1.0f/pSizeData->m_FontSize; float Uscale = 1.0f/pSizeData->m_TextureWidth; float Vscale = 1.0f/pSizeData->m_TextureHeight; int Height = pBitmap->rows + OutlineThickness*2 + 2; // ignore_convention int Width = pBitmap->width + OutlineThickness*2 + 2; // ignore_convention - pFontchr->m_Id = Chr; + pFontchr->m_ID = Chr; pFontchr->m_Height = Height * Scale; pFontchr->m_Width = Width * Scale; pFontchr->m_OffsetX = (pFont->m_FtFace->glyph->bitmap_left-1) * Scale; // ignore_convention pFontchr->m_OffsetY = (pSizeData->m_FontSize - pFont->m_FtFace->glyph->bitmap_top) * Scale; // ignore_convention pFontchr->m_AdvanceX = (pFont->m_FtFace->glyph->advance.x>>6) * Scale; // ignore_convention - pFontchr->m_aUvs[0] = (SlotId%pSizeData->m_NumXChars) / (float)(pSizeData->m_NumXChars); - pFontchr->m_aUvs[1] = (SlotId/pSizeData->m_NumXChars) / (float)(pSizeData->m_NumYChars); + pFontchr->m_aUvs[0] = (SlotID%pSizeData->m_NumXChars) / (float)(pSizeData->m_NumXChars); + pFontchr->m_aUvs[1] = (SlotID/pSizeData->m_NumXChars) / (float)(pSizeData->m_NumYChars); pFontchr->m_aUvs[2] = pFontchr->m_aUvs[0] + Width*Uscale; pFontchr->m_aUvs[3] = pFontchr->m_aUvs[1] + Height*Vscale; } - return SlotId; + return SlotID; } CFontChar *GetChar(CFont *pFont, CFontSizeData *pSizeData, int Chr) @@ -396,7 +396,7 @@ class CTextRender : public IEngineTextRender int i; for(i = 0; i < pSizeData->m_CurrentCharacter; i++) { - if(pSizeData->m_aCharacters[i].m_Id == Chr) + if(pSizeData->m_aCharacters[i].m_ID == Chr) { pFontchr = &pSizeData->m_aCharacters[i]; break; |