do not call BuildLookupTable if for whatever reason a font has no glyphs

This commit is contained in:
Soreepeong 2022-09-05 10:20:10 +09:00
parent f86885ec39
commit b666be53f9
3 changed files with 12 additions and 4 deletions

View file

@ -163,7 +163,7 @@ namespace Dalamud.Interface.GameFonts
font->FrequentKerningPairs.Ref<float>(i) /= fontScale;
}
if (rebuildLookupTable)
if (rebuildLookupTable && fontPtr.Glyphs.Size > 0)
fontPtr.BuildLookupTable();
}

View file

@ -220,7 +220,7 @@ namespace Dalamud.Interface
}
}
if (rebuildLookupTable)
if (rebuildLookupTable && target.Value!.Glyphs.Size > 0)
target.Value!.BuildLookupTable();
}

View file

@ -816,7 +816,7 @@ namespace Dalamud.Interface.Internal
for (int i = 0, i_ = ioFonts.ConfigData.Size; i < i_; i++)
{
var config = ioFonts.ConfigData[i];
config.RasterizerGamma = config.RasterizerGamma * fontGamma;
config.RasterizerGamma *= fontGamma;
}
Log.Verbose("[FONT] ImGui.IO.Build will be called.");
@ -876,7 +876,15 @@ namespace Dalamud.Interface.Internal
for (int i = 0, i_ = ioFonts.Fonts.Size; i < i_; i++)
{
var font = ioFonts.Fonts[i];
if (font.Glyphs.Size == 0)
{
Log.Warning("[FONT] Font has no glyph: {0}", font.GetDebugName());
continue;
}
if (font.FindGlyphNoFallback(Fallback1Codepoint).NativePtr != null)
font.FallbackChar = Fallback1Codepoint;
font.BuildLookupTable();
}