Fixed fallback font rendering

This commit is contained in:
Simon Lübeß
2022-02-22 20:18:06 +01:00
parent 373980d5ad
commit 6f999da1b8
2 changed files with 17 additions and 17 deletions
+13 -13
View File
@@ -141,6 +141,14 @@ namespace GlitchyEngine.Renderer.Text
Log.EngineLogger.Assert(res.Success, scope $"Set_Pixel_Sizes failed({(int)res}): {res}");
}
// HarfBuzz
{
Debug.Profiler.ProfileResourceScope!("hb_ft_font_create_referenced");
_harfBuzzFont = hb_ft_font_create_referenced(_face);
hb_font_set_scale(_harfBuzzFont, (.)fontSize * 64, (.)fontSize * 64);
}
double unitsPerEm = F26Dot6ToDouble(_face.units_per_EM);
_geometryScaler = _fontSize / unitsPerEm;
@@ -155,14 +163,6 @@ namespace GlitchyEngine.Renderer.Text
LoadGlyphs(firstChar, charCount);
// HarfBuzz
{
Debug.Profiler.ProfileResourceScope!("hb_ft_font_create_referenced");
_harfBuzzFont = hb_ft_font_create_referenced(_face);
hb_font_set_scale(_harfBuzzFont, (.)fontSize * 64, (.)fontSize * 64);
}
//TestMSDF();
}
@@ -185,17 +185,17 @@ namespace GlitchyEngine.Renderer.Text
}
/// Returns the font that can draw the char
static internal Font GetDrawingFont(char32 char, Font font)
internal Font GetDrawingFont(char32 char)
{
uint32 glyphId = FreeType.Get_Char_Index(font._face, char);
uint32 glyphId = FreeType.Get_Char_Index(_face, char);
if (glyphId != 0)
{
return font;
return this;
}
else if (font.Fallback != null)
else if (Fallback != null)
{
return GetDrawingFont(char, font.Fallback);
return Fallback.GetDrawingFont(char);
}
else
{