mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fix zero fonsize
This commit is contained in:
parent
a84649c0ee
commit
0353eb94ef
|
@ -1700,6 +1700,12 @@ public:
|
|||
|
||||
virtual void UploadEntityLayerText(int TextureID, const char *pText, int Length, float x, float y, int FontSize)
|
||||
{
|
||||
if (FontSize < 1)
|
||||
{
|
||||
dbg_msg("pFont", "texture with id '%d' will not be updated. Reason - font is too small", TextureID);
|
||||
return;
|
||||
}
|
||||
|
||||
const char *pCurrent = (char *)pText;
|
||||
const char *pEnd = pCurrent + Length;
|
||||
CFont *pFont = m_pDefaultFont;
|
||||
|
@ -1715,7 +1721,7 @@ public:
|
|||
{
|
||||
unsigned int px, py;
|
||||
|
||||
FT_Set_Pixel_Sizes(pFont->m_FtFace, 0, FontSize-1);
|
||||
FT_Set_Pixel_Sizes(pFont->m_FtFace, 0, FontSize);
|
||||
|
||||
if(FT_Load_Char(pFont->m_FtFace, NextCharacter, FT_LOAD_RENDER|FT_LOAD_NO_BITMAP))
|
||||
{
|
||||
|
|
|
@ -182,6 +182,13 @@ int CMapImages::UploadEntityLayerText(int TextureSize, int YOffset)
|
|||
int Len = str_format(aBuf, 4, "%d", 255);
|
||||
|
||||
int FontSize = TextRender()->AdjustFontSize(aBuf, Len, TextureSize);
|
||||
|
||||
if (FontSize < 1)
|
||||
{
|
||||
dbg_msg("pFont", "texture with id '%d' will not be loaded. Reason - font is too small", TextureID);
|
||||
return TextureID;
|
||||
}
|
||||
|
||||
YOffset += ((TextureSize - FontSize)/2);
|
||||
|
||||
for(int i = 0; i < 256; ++i)
|
||||
|
|
Loading…
Reference in a new issue