Finally debugged and fixed cleanup error in Font

This commit is contained in:
Simon Lübeß
2026-08-02 12:00:40 +02:00
parent 8b64afee0c
commit a14d86012a
+3 -6
View File
@@ -51,10 +51,8 @@ namespace GlitchyEngine.Renderer.Text
public Padding boxOuterPadding; public Padding boxOuterPadding;
} }
// TODO: I don't understand why freeing the face and hb_font sometimes results in an access violation... internal FT_Face _face ~ FreeType.Done_Face(_face);
internal FT_Face _face;// ~ FreeType.Done_Face(_face);//TODO!: ~ FreeType.Done_Face(_face); internal hb_font_t* _harfBuzzFont ~ hb_font_destroy(_);
internal hb_font_t* _harfBuzzFont;// ~ hb_font_destroy(_);//TODO:!! ~ hb_font_destroy(_);
internal hb_face_t* _harfBuzzFace;// ~ hb_face_destroy(_);//TODO:!! ~ hb_font_destroy(_);
private Font _fallback ~ _?.ReleaseRef(); private Font _fallback ~ _?.ReleaseRef();
@@ -172,9 +170,8 @@ namespace GlitchyEngine.Renderer.Text
Debug.Profiler.ProfileResourceScope!("hb_ft_font_create_referenced"); Debug.Profiler.ProfileResourceScope!("hb_ft_font_create_referenced");
_harfBuzzFont = hb_ft_font_create_referenced(_face); _harfBuzzFont = hb_ft_font_create_referenced(_face);
_harfBuzzFace = hb_font_get_face(_harfBuzzFont);
_unitsPerEm = hb_face_get_upem(_harfBuzzFace); _unitsPerEm = hb_face_get_upem(hb_font_get_face(_harfBuzzFont));
hb_font_set_scale(_harfBuzzFont, (.)_unitsPerEm, (.)_unitsPerEm); hb_font_set_scale(_harfBuzzFont, (.)_unitsPerEm, (.)_unitsPerEm);
} }