Skip to content

Commit bf970bd

Browse files
committed
Fix integer types for font metrics in PyGlyph class
The PyGlyph class defined in the freetype wrapper code pulls in some font metric values from freetype when initialized. All these values have type FT_Pos in freetype, which is a signed long, but in the PyMemberDef structure used to store those values in the Python class, their types were set to T_INT - signed int. We should set them to T_LONG instead. This fixes several hundred test suite errors on big-endian arches.
1 parent b0e4b67 commit bf970bd

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/ft2font_wrapper.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -282,15 +282,15 @@ static PyObject *PyGlyph_get_bbox(PyGlyph *self, void *closure)
282282
static PyTypeObject *PyGlyph_init_type(PyObject *m, PyTypeObject *type)
283283
{
284284
static PyMemberDef members[] = {
285-
{(char *)"width", T_INT, offsetof(PyGlyph, width), READONLY, (char *)""},
286-
{(char *)"height", T_INT, offsetof(PyGlyph, height), READONLY, (char *)""},
287-
{(char *)"horiBearingX", T_INT, offsetof(PyGlyph, horiBearingX), READONLY, (char *)""},
288-
{(char *)"horiBearingY", T_INT, offsetof(PyGlyph, horiBearingY), READONLY, (char *)""},
289-
{(char *)"horiAdvance", T_INT, offsetof(PyGlyph, horiAdvance), READONLY, (char *)""},
290-
{(char *)"linearHoriAdvance", T_INT, offsetof(PyGlyph, linearHoriAdvance), READONLY, (char *)""},
291-
{(char *)"vertBearingX", T_INT, offsetof(PyGlyph, vertBearingX), READONLY, (char *)""},
292-
{(char *)"vertBearingY", T_INT, offsetof(PyGlyph, vertBearingY), READONLY, (char *)""},
293-
{(char *)"vertAdvance", T_INT, offsetof(PyGlyph, vertAdvance), READONLY, (char *)""},
285+
{(char *)"width", T_LONG, offsetof(PyGlyph, width), READONLY, (char *)""},
286+
{(char *)"height", T_LONG, offsetof(PyGlyph, height), READONLY, (char *)""},
287+
{(char *)"horiBearingX", T_LONG, offsetof(PyGlyph, horiBearingX), READONLY, (char *)""},
288+
{(char *)"horiBearingY", T_LONG, offsetof(PyGlyph, horiBearingY), READONLY, (char *)""},
289+
{(char *)"horiAdvance", T_LONG, offsetof(PyGlyph, horiAdvance), READONLY, (char *)""},
290+
{(char *)"linearHoriAdvance", T_LONG, offsetof(PyGlyph, linearHoriAdvance), READONLY, (char *)""},
291+
{(char *)"vertBearingX", T_LONG, offsetof(PyGlyph, vertBearingX), READONLY, (char *)""},
292+
{(char *)"vertBearingY", T_LONG, offsetof(PyGlyph, vertBearingY), READONLY, (char *)""},
293+
{(char *)"vertAdvance", T_LONG, offsetof(PyGlyph, vertAdvance), READONLY, (char *)""},
294294
{NULL}
295295
};
296296

0 commit comments

Comments
 (0)