diff options
| author | oy <Tom_Adams@web.de> | 2011-01-04 12:30:40 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-01-04 12:30:40 +0100 |
| commit | 1928a757c6054a622fc7895e316ac89f102007ff (patch) | |
| tree | 8fc8625a38bddee3fa819cf7abd7eceb27af1247 /src/engine | |
| parent | 5dbe75fd7bca578c3d768021d8e3f4da75be1e79 (diff) | |
| download | zcatch-1928a757c6054a622fc7895e316ac89f102007ff.tar.gz zcatch-1928a757c6054a622fc7895e316ac89f102007ff.zip | |
added fix for rendering big fonts on large resolutions by RushPL
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/client/text.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp index b228443d..daf5cdb0 100644 --- a/src/engine/client/text.cpp +++ b/src/engine/client/text.cpp @@ -30,7 +30,7 @@ enum }; -static int aFontSizes[] = {8,9,10,11,12,13,14,15,16,17,18,19,20,36}; +static int aFontSizes[] = {8,9,10,11,12,13,14,15,16,17,18,19,20,36,64}; #define NUM_FONT_SIZES (sizeof(aFontSizes)/sizeof(int)) struct CFontChar @@ -178,6 +178,15 @@ class CTextRender : public IEngineTextRender mem_free(pMem); } + int AdjustOutlineThicknessToFontSize(int OutlineThickness, int FontSize) + { + if(FontSize > 36) + OutlineThickness *= 4; + else if(FontSize >= 18) + OutlineThickness *= 2; + return OutlineThickness; + } + void IncreaseTextureSize(CFontSizeData *pSizeData) { if(pSizeData->m_TextureWidth < pSizeData->m_TextureHeight) @@ -191,14 +200,12 @@ class CTextRender : public IEngineTextRender // TODO: Refactor: move this into a pFont class void InitIndex(CFont *pFont, int Index) { - int OutlineThickness = 1; CFontSizeData *pSizeData = &pFont->m_aSizes[Index]; pSizeData->m_FontSize = aFontSizes[Index]; FT_Set_Pixel_Sizes(pFont->m_FtFace, 0, pSizeData->m_FontSize); - if(pSizeData->m_FontSize >= 18) - OutlineThickness = 2; + int OutlineThickness = AdjustOutlineThicknessToFontSize(1, pSizeData->m_FontSize); { unsigned GlyphIndex; @@ -290,7 +297,6 @@ class CTextRender : public IEngineTextRender int SlotW = pSizeData->m_TextureWidth / pSizeData->m_NumXChars; int SlotH = pSizeData->m_TextureHeight / pSizeData->m_NumYChars; int SlotSize = SlotW*SlotH; - int OutlineThickness = 1; int x = 1; int y = 1; int px, py; @@ -311,8 +317,7 @@ class CTextRender : public IEngineTextRender return -1; // adjust spacing - if(pSizeData->m_FontSize >= 18) - OutlineThickness = 2; + int OutlineThickness = AdjustOutlineThicknessToFontSize(1, pSizeData->m_FontSize); x += OutlineThickness; y += OutlineThickness; |