Release old hb_font when changing font size

This commit is contained in:
Kovid Goyal
2017-10-31 01:47:14 +05:30
parent 5007a82ea6
commit 729395c887

View File

@@ -144,6 +144,7 @@ apply_size(Face *self, float point_sz, float dpi) {
if (face == NULL) { PyErr_SetString(PyExc_ValueError, "Failed to create hb_face"); return false; }
CGFontRelease(cg_font);
unsigned int upem = hb_face_get_upem(face);
if (self->harfbuzz_font) hb_font_destroy(self->harfbuzz_font);
self->harfbuzz_font = hb_font_create(face);
hb_face_destroy(face);
hb_font_set_scale(self->harfbuzz_font, upem, upem);