From 39ae5d62f0293738a5f697cc87a20a2c7c2bda83 Mon Sep 17 00:00:00 2001 From: nulano Date: Mon, 12 Oct 2020 01:45:52 +0100 Subject: [PATCH] compatibility code for ancient FreeType --- src/_imagingft.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/_imagingft.c b/src/_imagingft.c index a35105c9b25..7e9c1fb16b0 100644 --- a/src/_imagingft.c +++ b/src/_imagingft.c @@ -1007,7 +1007,13 @@ font_render(FontObject* self, PyObject* args) case FT_PIXEL_MODE_GRAY2: case FT_PIXEL_MODE_GRAY4: if (!bitmap_converted_ready) { + +#if FREETYPE_MAJOR > 2 ||\ + (FREETYPE_MAJOR == 2 && FREETYPE_MINOR > 6) FT_Bitmap_Init(&bitmap_converted); +#else + FT_Bitmap_New(&bitmap_converted); +#endif bitmap_converted_ready = 1; } error = FT_Bitmap_Convert(library, &bitmap, &bitmap_converted, 1);