mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Close #891: a dirty solution to embedded bitmap fonts.
Since embedded bitmap font works incorrectly, we should avoid using them, until a final patch is available and tested. I've added `FT_LOAD_NO_BITMAP` to ALL(3) places in `_imagingft.c`, which did (not much) actually fixed the issue. A notice has also been added to `_imagingft.c`.
This commit is contained in:
parent
ede3e81877
commit
307726edc0
17
_imagingft.c
17
_imagingft.c
|
@ -18,6 +18,17 @@
|
|||
* Copyright (c) 1998-2007 by Secret Labs AB
|
||||
*/
|
||||
|
||||
/*
|
||||
* Notes:
|
||||
* Currently, embedded bitmap fonts within truetype fonts do not work
|
||||
* properly (see issue #891), truetype fonts are loaded with
|
||||
* FT_LOAD_NO_BITMAP load flags, resulting in embedded bitmap fonts
|
||||
* not being used.
|
||||
*
|
||||
* Yifu Yu<root@jackyyf.com>
|
||||
* 2014-10-15
|
||||
*/
|
||||
|
||||
#include "Python.h"
|
||||
#include "Imaging.h"
|
||||
|
||||
|
@ -243,7 +254,7 @@ font_getsize(FontObject* self, PyObject* args)
|
|||
&delta);
|
||||
x += delta.x;
|
||||
}
|
||||
error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT);
|
||||
error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT|FT_LOAD_NO_BITMAP);
|
||||
if (error)
|
||||
return geterror(error);
|
||||
if (i == 0)
|
||||
|
@ -316,7 +327,7 @@ font_getabc(FontObject* self, PyObject* args)
|
|||
int index, error;
|
||||
face = self->face;
|
||||
index = FT_Get_Char_Index(face, ch);
|
||||
error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT);
|
||||
error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT|FT_LOAD_NO_BITMAP);
|
||||
if (error)
|
||||
return geterror(error);
|
||||
a = face->glyph->metrics.horiBearingX / 64.0;
|
||||
|
@ -364,7 +375,7 @@ font_render(FontObject* self, PyObject* args)
|
|||
|
||||
im = (Imaging) id;
|
||||
|
||||
load_flags = FT_LOAD_RENDER;
|
||||
load_flags = FT_LOAD_RENDER|FT_LOAD_NO_BITMAP;
|
||||
if (mask)
|
||||
load_flags |= FT_LOAD_TARGET_MONO;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user