mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #1546 from def-/pr-glyph-missing
Fix text render when a glyph is missing (fixes #1543)
This commit is contained in:
commit
5124372e9d
|
@ -447,7 +447,19 @@ class CTextRender : public IEngineTextRender
|
|||
if(pFont->m_FtFace->charmap)
|
||||
GlyphIndex = FT_Get_Char_Index(pFont->m_FtFace, (FT_ULong)Chr);
|
||||
|
||||
if(GlyphIndex != 0 && FT_Load_Glyph(pFont->m_FtFace, GlyphIndex, FT_LOAD_RENDER|FT_LOAD_NO_BITMAP))
|
||||
if(GlyphIndex == 0)
|
||||
{
|
||||
const int ReplacementChr = 0x25a1; // White square to indicate missing glyph
|
||||
GlyphIndex = FT_Get_Char_Index(pFont->m_FtFace, (FT_ULong)ReplacementChr);
|
||||
|
||||
if(GlyphIndex == 0)
|
||||
{
|
||||
dbg_msg("pFont", "font has no glyph for either %d or replacement char %d", Chr, ReplacementChr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(FT_Load_Glyph(pFont->m_FtFace, GlyphIndex, FT_LOAD_RENDER|FT_LOAD_NO_BITMAP))
|
||||
{
|
||||
dbg_msg("pFont", "error loading glyph %d", Chr);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue