Fix another integer type issue which caused more issues on ppc64

This commit is contained in:
Adam Williamson 2017-01-09 23:33:01 -08:00
parent cf0338c697
commit cab430591a
3 changed files with 59 additions and 2 deletions

View File

@ -0,0 +1,48 @@
From bf970bd8bc13b4e6e281a47163527909270edcbf Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Mon, 9 Jan 2017 22:56:40 -0800
Subject: [PATCH] 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.
---
src/ft2font_wrapper.cpp | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/ft2font_wrapper.cpp b/src/ft2font_wrapper.cpp
index c77dd8363..62fbf0a0c 100644
--- a/src/ft2font_wrapper.cpp
+++ b/src/ft2font_wrapper.cpp
@@ -282,15 +282,15 @@ static PyObject *PyGlyph_get_bbox(PyGlyph *self, void *closure)
static PyTypeObject *PyGlyph_init_type(PyObject *m, PyTypeObject *type)
{
static PyMemberDef members[] = {
- {(char *)"width", T_INT, offsetof(PyGlyph, width), READONLY, (char *)""},
- {(char *)"height", T_INT, offsetof(PyGlyph, height), READONLY, (char *)""},
- {(char *)"horiBearingX", T_INT, offsetof(PyGlyph, horiBearingX), READONLY, (char *)""},
- {(char *)"horiBearingY", T_INT, offsetof(PyGlyph, horiBearingY), READONLY, (char *)""},
- {(char *)"horiAdvance", T_INT, offsetof(PyGlyph, horiAdvance), READONLY, (char *)""},
- {(char *)"linearHoriAdvance", T_INT, offsetof(PyGlyph, linearHoriAdvance), READONLY, (char *)""},
- {(char *)"vertBearingX", T_INT, offsetof(PyGlyph, vertBearingX), READONLY, (char *)""},
- {(char *)"vertBearingY", T_INT, offsetof(PyGlyph, vertBearingY), READONLY, (char *)""},
- {(char *)"vertAdvance", T_INT, offsetof(PyGlyph, vertAdvance), READONLY, (char *)""},
+ {(char *)"width", T_LONG, offsetof(PyGlyph, width), READONLY, (char *)""},
+ {(char *)"height", T_LONG, offsetof(PyGlyph, height), READONLY, (char *)""},
+ {(char *)"horiBearingX", T_LONG, offsetof(PyGlyph, horiBearingX), READONLY, (char *)""},
+ {(char *)"horiBearingY", T_LONG, offsetof(PyGlyph, horiBearingY), READONLY, (char *)""},
+ {(char *)"horiAdvance", T_LONG, offsetof(PyGlyph, horiAdvance), READONLY, (char *)""},
+ {(char *)"linearHoriAdvance", T_LONG, offsetof(PyGlyph, linearHoriAdvance), READONLY, (char *)""},
+ {(char *)"vertBearingX", T_LONG, offsetof(PyGlyph, vertBearingX), READONLY, (char *)""},
+ {(char *)"vertBearingY", T_LONG, offsetof(PyGlyph, vertBearingY), READONLY, (char *)""},
+ {(char *)"vertAdvance", T_LONG, offsetof(PyGlyph, vertAdvance), READONLY, (char *)""},
{NULL}
};
--
2.11.0

View File

@ -52,7 +52,7 @@
Name: python-matplotlib
Version: 2.0.0
Release: 0.5%{?rctag:.%{rctag}}%{?dist}
Release: 0.6%{?rctag:.%{rctag}}%{?dist}
Summary: Python 2D plotting library
Group: Development/Libraries
# qt4_editor backend is MIT
@ -72,7 +72,12 @@ Patch9: python-matplotlib-qhull.patch
Patch10: python-matplotlib-increase-tests-tolerance.patch
Patch11: python-matplotlib-increase-tests-tolerance-aarch64.patch
Patch13: python-matplotlib-increase-tests-tolerance-i686.patch
Patch14: https://github.com/matplotlib/matplotlib/pull/7768.patch
# These two patches fix some integer type issues which broke matplotlib
# badly on ppc64 (big-endian)
# https://github.com/matplotlib/matplotlib/pull/7768
Patch14: https://github.com/matplotlib/matplotlib/commit/b0e4b6708d71df80999764eb4b65cc1d388a521f.patch
# https://github.com/matplotlib/matplotlib/pull/7781
Patch15: 0001-Fix-integer-types-for-font-metrics-in-PyGlyph-class.patch
BuildRequires: freetype-devel
BuildRequires: libpng-devel
@ -420,6 +425,7 @@ sed -i 's/\(USE_FONTCONFIG = \)False/\1True/' lib/matplotlib/font_manager.py
%patch13 -p1 -b .tests-i686
%endif
%patch14 -p1 -b .inttype
%patch15 -p1 -b .moreints
chmod -x lib/matplotlib/mpl-data/images/*.svg
chmod -x lib/matplotlib/{dates,sankey}.py
@ -618,6 +624,9 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} \
%endif
%changelog
* Mon Jan 09 2017 Adam Williamson <awilliam@redhat.com> - 2.0.0-0.6.b4
- Fix another integer type issue which caused more issues on ppc64
* Sun Jan 08 2017 Adam Williamson <awilliam@redhat.com> - 2.0.0-0.5.b4
- Fix int type conversion error that broke text rendering on ppc64 (#1411070)