fonts: Allow deallocation and clear face cache.

So fonts can be reloaded when required. Fixes #6153.
This commit is contained in:
Tom Rothamel
2025-02-12 22:51:50 -05:00
parent 8de2bda1e6
commit 6c948bf046
3 changed files with 7 additions and 0 deletions
+1
View File
@@ -761,6 +761,7 @@ def free_memory():
scaled_image_fonts.clear()
font_cache.clear()
face_cache.clear()
def load_fonts():
+4
View File
@@ -188,6 +188,10 @@ cdef class FTFace:
public object fn
def __dealloc__(self):
if self.face != NULL:
FT_Done_Face(self.face)
def __init__(self, f, index, fn):
cdef int error
+2
View File
@@ -369,6 +369,8 @@ cdef class HBFace:
if self.mm_var:
FT_Done_MM_Var(library, self.mm_var)
FT_Done_Face(self.face)
def __init__(self, f, index, fn):
cdef int error