mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 10:46:16 +03:00
Do not destroy glyph while its bitmap is used
This commit is contained in:
parent
c4f2c32e2c
commit
2694564d08
|
@ -791,7 +791,7 @@ font_render(FontObject* self, PyObject* args)
|
||||||
int index, error, ascender, horizontal_dir;
|
int index, error, ascender, horizontal_dir;
|
||||||
int load_flags;
|
int load_flags;
|
||||||
unsigned char *source;
|
unsigned char *source;
|
||||||
FT_Glyph glyph;
|
FT_Glyph glyph = NULL;
|
||||||
FT_GlyphSlot glyph_slot;
|
FT_GlyphSlot glyph_slot;
|
||||||
FT_Bitmap bitmap;
|
FT_Bitmap bitmap;
|
||||||
FT_BitmapGlyph bitmap_glyph;
|
FT_BitmapGlyph bitmap_glyph;
|
||||||
|
@ -890,8 +890,6 @@ font_render(FontObject* self, PyObject* args)
|
||||||
|
|
||||||
bitmap = bitmap_glyph->bitmap;
|
bitmap = bitmap_glyph->bitmap;
|
||||||
left = bitmap_glyph->left;
|
left = bitmap_glyph->left;
|
||||||
|
|
||||||
FT_Done_Glyph(glyph);
|
|
||||||
} else {
|
} else {
|
||||||
bitmap = glyph_slot->bitmap;
|
bitmap = glyph_slot->bitmap;
|
||||||
left = glyph_slot->bitmap_left;
|
left = glyph_slot->bitmap_left;
|
||||||
|
@ -953,6 +951,10 @@ font_render(FontObject* self, PyObject* args)
|
||||||
}
|
}
|
||||||
x += glyph_info[i].x_advance;
|
x += glyph_info[i].x_advance;
|
||||||
y -= glyph_info[i].y_advance;
|
y -= glyph_info[i].y_advance;
|
||||||
|
if (glyph != NULL) {
|
||||||
|
FT_Done_Glyph(glyph);
|
||||||
|
glyph = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FT_Stroker_Done(stroker);
|
FT_Stroker_Done(stroker);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user