1 |
commit: d17321f41ab64f54c28b3a22e1e14233acaf6573 |
2 |
Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Apr 27 23:55:06 2020 +0000 |
4 |
Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Apr 27 23:55:06 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d17321f4 |
7 |
|
8 |
media-gfx/fontforge: fix python extension on big-endian |
9 |
|
10 |
Closes: https://bugs.gentoo.org/719058 |
11 |
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org> |
12 |
|
13 |
.../fontforge/files/20200314-big-endian.patch | 298 +++++++++++++++++++++ |
14 |
media-gfx/fontforge/fontforge-20200314.ebuild | 1 + |
15 |
2 files changed, 299 insertions(+) |
16 |
|
17 |
diff --git a/media-gfx/fontforge/files/20200314-big-endian.patch b/media-gfx/fontforge/files/20200314-big-endian.patch |
18 |
new file mode 100644 |
19 |
index 00000000000..f9581ad35f4 |
20 |
--- /dev/null |
21 |
+++ b/media-gfx/fontforge/files/20200314-big-endian.patch |
22 |
@@ -0,0 +1,298 @@ |
23 |
+From 65619185a42bd52bb4a4894c1714d78d96ed4175 Mon Sep 17 00:00:00 2001 |
24 |
+From: Jeremy Tan <jtanx@×××××××.com> |
25 |
+Date: Sun, 26 Apr 2020 18:57:58 +1000 |
26 |
+Subject: [PATCH 1/2] tottfgpos.c: fix incorrect sizing of the scripts array |
27 |
+ |
28 |
+latn contains 58 entries (29 pairs), meaning the size was too small |
29 |
+to fit the 0 marker at the end of the array |
30 |
+--- |
31 |
+ fontforge/tottfgpos.c | 2 +- |
32 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
33 |
+ |
34 |
+diff --git a/fontforge/tottfgpos.c b/fontforge/tottfgpos.c |
35 |
+index 5de5164ed1..e12a0b8a79 100644 |
36 |
+--- a/fontforge/tottfgpos.c |
37 |
++++ b/fontforge/tottfgpos.c |
38 |
+@@ -60,7 +60,7 @@ int use_second_indic_scripts = false; |
39 |
+ /* scripts (for opentype) that I understand */ |
40 |
+ /* see also list in lookups.c mapping script tags to friendly names */ |
41 |
+ |
42 |
+-static uint32 scripts[][59] = { |
43 |
++static uint32 scripts[][61] = { |
44 |
+ /* Adlam */ { CHR('a','d','l','m'), 0x1e900, 0x1e95f }, |
45 |
+ /* Ahom */ { CHR('a','h','o','m'), 0x11700, 0x1173f }, |
46 |
+ /* Anatolian */ { CHR('h','l','u','w'), 0x14400, 0x1467f }, |
47 |
+ |
48 |
+From fde85b13382595cb3ab889e38570b4944edad808 Mon Sep 17 00:00:00 2001 |
49 |
+From: Jeremy Tan <jtanx@×××××××.com> |
50 |
+Date: Sun, 26 Apr 2020 19:00:04 +1000 |
51 |
+Subject: [PATCH 2/2] python.c: fix type specifier on long input/return values |
52 |
+ |
53 |
+int is guaranteed to be at least 16 bits, while long is at least |
54 |
+32 bits. So for uint32/int32 values, parse longs with the "l"/"k" |
55 |
+specifier and cast return values to long. |
56 |
+ |
57 |
+The cast is necessary as on amd64 a long is 64 bits |
58 |
+--- |
59 |
+ fontforge/python.c | 68 +++++++++++++++++++++++----------------------- |
60 |
+ 1 file changed, 34 insertions(+), 34 deletions(-) |
61 |
+ |
62 |
+diff --git a/fontforge/python.c b/fontforge/python.c |
63 |
+index 5344b0f60f..6c9675fa4e 100644 |
64 |
+--- a/fontforge/python.c |
65 |
++++ b/fontforge/python.c |
66 |
+@@ -760,7 +760,7 @@ static PyObject *PyFF_UnicodeAnnotationFromLib(PyObject *UNUSED(self), PyObject |
67 |
+ char *temp; |
68 |
+ long val; |
69 |
+ |
70 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
71 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
72 |
+ return( NULL ); |
73 |
+ |
74 |
+ if ( (temp=unicode_annot(val))==NULL ) { |
75 |
+@@ -777,7 +777,7 @@ static PyObject *PyFF_UnicodeNameFromLib(PyObject *UNUSED(self), PyObject *args) |
76 |
+ char *temp; |
77 |
+ long val; |
78 |
+ |
79 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
80 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
81 |
+ return( NULL ); |
82 |
+ |
83 |
+ if ( (temp=unicode_name(val))==NULL ) { |
84 |
+@@ -798,10 +798,10 @@ static PyObject *PyFF_UnicodeBlockStartFromLib(PyObject *UNUSED(self), PyObject |
85 |
+ /* Use this function with UnicodeBlockNameFromLib(n) & UnicodeBlockEndFromLib(n). */ |
86 |
+ long val; |
87 |
+ |
88 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
89 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
90 |
+ return( NULL ); |
91 |
+ |
92 |
+- return( Py_BuildValue("i", unicode_block_start(val)) ); |
93 |
++ return( Py_BuildValue("l", (long)unicode_block_start(val)) ); |
94 |
+ } |
95 |
+ |
96 |
+ static PyObject *PyFF_UnicodeBlockEndFromLib(PyObject *UNUSED(self), PyObject *args) { |
97 |
+@@ -809,10 +809,10 @@ static PyObject *PyFF_UnicodeBlockEndFromLib(PyObject *UNUSED(self), PyObject *a |
98 |
+ /* Use this function with UnicodeBlockStartFromLib(n), UnicodeBlockNameFromLib(n) */ |
99 |
+ long val; |
100 |
+ |
101 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
102 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
103 |
+ return( NULL ); |
104 |
+ |
105 |
+- return( Py_BuildValue("i", unicode_block_end(val)) ); |
106 |
++ return( Py_BuildValue("l", (long)unicode_block_end(val)) ); |
107 |
+ } |
108 |
+ |
109 |
+ static PyObject *PyFF_UnicodeBlockNameFromLib(PyObject *UNUSED(self), PyObject *args) { |
110 |
+@@ -822,7 +822,7 @@ static PyObject *PyFF_UnicodeBlockNameFromLib(PyObject *UNUSED(self), PyObject * |
111 |
+ char *temp; |
112 |
+ long val; |
113 |
+ |
114 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
115 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
116 |
+ return( NULL ); |
117 |
+ |
118 |
+ if ( (temp=unicode_block_name(val))==NULL ) { |
119 |
+@@ -853,24 +853,24 @@ static PyObject *PyFF_UnicodeNames2GetCntFromLib(PyObject *UNUSED(self), PyObjec |
120 |
+ static PyObject *PyFF_UnicodeNames2GetNxtFromLib(PyObject *UNUSED(self), PyObject *args) { |
121 |
+ long val; |
122 |
+ |
123 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
124 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
125 |
+ return( NULL ); |
126 |
+- return( Py_BuildValue("i", unicode_names2getUtabLoc(val)) ); |
127 |
++ return( Py_BuildValue("l", (long)unicode_names2getUtabLoc(val)) ); |
128 |
+ } |
129 |
+ |
130 |
+ static PyObject *PyFF_UnicodeNames2NxtUniFromLib(PyObject *UNUSED(self), PyObject *args) { |
131 |
+ long val; |
132 |
+ |
133 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
134 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
135 |
+ return( NULL ); |
136 |
+- return( Py_BuildValue("i", unicode_names2valFrmTab(val)) ); |
137 |
++ return( Py_BuildValue("l", (long)unicode_names2valFrmTab(val)) ); |
138 |
+ } |
139 |
+ |
140 |
+ static PyObject *PyFF_UnicodeNames2FrmTabFromLib(PyObject *UNUSED(self), PyObject *args) { |
141 |
+ long val; |
142 |
+ char *temp; |
143 |
+ |
144 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
145 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
146 |
+ return( NULL ); |
147 |
+ if ( (temp=unicode_name2FrmTab(val))==NULL ) { |
148 |
+ return Py_BuildValue("s", ""); |
149 |
+@@ -883,7 +883,7 @@ static PyObject *PyFF_UnicodeNames2FromLib(PyObject *UNUSED(self), PyObject *arg |
150 |
+ long val; |
151 |
+ char *temp; |
152 |
+ |
153 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
154 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
155 |
+ return( NULL ); |
156 |
+ if ( (temp=unicode_name2(val))==NULL ) { |
157 |
+ return Py_BuildValue("s", ""); |
158 |
+@@ -899,7 +899,7 @@ static PyObject *PyFF_UnicodeNames2FromLib(PyObject *UNUSED(self), PyObject *arg |
159 |
+ static PyObject *PyFF_isligature(PyObject *UNUSED(self), PyObject *args) { |
160 |
+ long codepoint; |
161 |
+ |
162 |
+- if ( !PyArg_ParseTuple(args,"|i",&codepoint) ) |
163 |
++ if ( !PyArg_ParseTuple(args,"|l",&codepoint) ) |
164 |
+ return( NULL ); |
165 |
+ |
166 |
+ return( Py_BuildValue("i", is_LIGATURE(codepoint)==0?1:0) ); |
167 |
+@@ -908,7 +908,7 @@ static PyObject *PyFF_isligature(PyObject *UNUSED(self), PyObject *args) { |
168 |
+ static PyObject *PyFF_isvulgarfraction(PyObject *UNUSED(self), PyObject *args) { |
169 |
+ long codepoint; |
170 |
+ |
171 |
+- if ( !PyArg_ParseTuple(args,"|i",&codepoint) ) |
172 |
++ if ( !PyArg_ParseTuple(args,"|l",&codepoint) ) |
173 |
+ return( NULL ); |
174 |
+ |
175 |
+ return( Py_BuildValue("i", is_VULGAR_FRACTION(codepoint)==0?1:0) ); |
176 |
+@@ -917,7 +917,7 @@ static PyObject *PyFF_isvulgarfraction(PyObject *UNUSED(self), PyObject *args) { |
177 |
+ static PyObject *PyFF_isotherfraction(PyObject *UNUSED(self), PyObject *args) { |
178 |
+ long codepoint; |
179 |
+ |
180 |
+- if ( !PyArg_ParseTuple(args,"|i",&codepoint) ) |
181 |
++ if ( !PyArg_ParseTuple(args,"|l",&codepoint) ) |
182 |
+ return( NULL ); |
183 |
+ |
184 |
+ return( Py_BuildValue("i", is_OTHER_FRACTION(codepoint)==0?1:0) ); |
185 |
+@@ -926,7 +926,7 @@ static PyObject *PyFF_isotherfraction(PyObject *UNUSED(self), PyObject *args) { |
186 |
+ static PyObject *PyFF_isfraction(PyObject *UNUSED(self), PyObject *args) { |
187 |
+ long codepoint; |
188 |
+ |
189 |
+- if ( !PyArg_ParseTuple(args,"|i",&codepoint) ) |
190 |
++ if ( !PyArg_ParseTuple(args,"|l",&codepoint) ) |
191 |
+ return( NULL ); |
192 |
+ |
193 |
+ return( Py_BuildValue("i", (is_VULGAR_FRACTION(codepoint)==0 || \ |
194 |
+@@ -957,28 +957,28 @@ static PyObject *PyFF_FracChartGetCnt(PyObject *UNUSED(self), PyObject *UNUSED(a |
195 |
+ static PyObject *PyFF_LigChartGetNxt(PyObject *UNUSED(self), PyObject *args) { |
196 |
+ long val; |
197 |
+ |
198 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
199 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
200 |
+ return( NULL ); |
201 |
+ |
202 |
+- return( Py_BuildValue("i", Ligature_get_U(val)) ); |
203 |
++ return( Py_BuildValue("l", (long)Ligature_get_U(val)) ); |
204 |
+ } |
205 |
+ |
206 |
+ static PyObject *PyFF_VulChartGetNxt(PyObject *UNUSED(self), PyObject *args) { |
207 |
+ long val; |
208 |
+ |
209 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
210 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
211 |
+ return( NULL ); |
212 |
+ |
213 |
+- return( Py_BuildValue("i", VulgFrac_get_U(val)) ); |
214 |
++ return( Py_BuildValue("l", (long)VulgFrac_get_U(val)) ); |
215 |
+ } |
216 |
+ |
217 |
+ static PyObject *PyFF_OFracChartGetNxt(PyObject *UNUSED(self), PyObject *args) { |
218 |
+ long val; |
219 |
+ |
220 |
+- if ( !PyArg_ParseTuple(args,"|i",&val) ) |
221 |
++ if ( !PyArg_ParseTuple(args,"|l",&val) ) |
222 |
+ return( NULL ); |
223 |
+ |
224 |
+- return( Py_BuildValue("i", Fraction_get_U(val)) ); |
225 |
++ return( Py_BuildValue("l", (long)Fraction_get_U(val)) ); |
226 |
+ } |
227 |
+ |
228 |
+ /* If you have a unicode ligature, or fraction, these routines return loc n. */ |
229 |
+@@ -987,7 +987,7 @@ static PyObject *PyFF_OFracChartGetNxt(PyObject *UNUSED(self), PyObject *args) { |
230 |
+ static PyObject *PyFF_LigChartGetLoc(PyObject *UNUSED(self), PyObject *args) { |
231 |
+ long codepoint; |
232 |
+ |
233 |
+- if ( !PyArg_ParseTuple(args,"|i",&codepoint) ) |
234 |
++ if ( !PyArg_ParseTuple(args,"|l",&codepoint) ) |
235 |
+ return( NULL ); |
236 |
+ |
237 |
+ return( Py_BuildValue("i", Ligature_find_N(codepoint)) ); |
238 |
+@@ -996,7 +996,7 @@ static PyObject *PyFF_LigChartGetLoc(PyObject *UNUSED(self), PyObject *args) { |
239 |
+ static PyObject *PyFF_VulChartGetLoc(PyObject *UNUSED(self), PyObject *args) { |
240 |
+ long codepoint; |
241 |
+ |
242 |
+- if ( !PyArg_ParseTuple(args,"|i",&codepoint) ) |
243 |
++ if ( !PyArg_ParseTuple(args,"|l",&codepoint) ) |
244 |
+ return( NULL ); |
245 |
+ |
246 |
+ return( Py_BuildValue("i", VulgFrac_find_N(codepoint)) ); |
247 |
+@@ -1005,7 +1005,7 @@ static PyObject *PyFF_VulChartGetLoc(PyObject *UNUSED(self), PyObject *args) { |
248 |
+ static PyObject *PyFF_OFracChartGetLoc(PyObject *UNUSED(self), PyObject *args) { |
249 |
+ long codepoint; |
250 |
+ |
251 |
+- if ( !PyArg_ParseTuple(args,"|i",&codepoint) ) |
252 |
++ if ( !PyArg_ParseTuple(args,"|l",&codepoint) ) |
253 |
+ return( NULL ); |
254 |
+ |
255 |
+ return( Py_BuildValue("i", Fraction_find_N(codepoint)) ); |
256 |
+@@ -1066,7 +1066,7 @@ static PyObject *PyFF_LigChartGetAltVal(PyObject *UNUSED(self), PyObject *args) |
257 |
+ |
258 |
+ if ( !PyArg_ParseTuple(args,"ll",&nthCode, &altN) ) |
259 |
+ return( NULL ); |
260 |
+- return( Py_BuildValue("i", Ligature_alt_getV(nthCode,altN)) ); |
261 |
++ return( Py_BuildValue("l", (long)Ligature_alt_getV(nthCode,altN)) ); |
262 |
+ } |
263 |
+ |
264 |
+ static PyObject *PyFF_LigChartUGetAltVal(PyObject *UNUSED(self), PyObject *args) { |
265 |
+@@ -1074,7 +1074,7 @@ static PyObject *PyFF_LigChartUGetAltVal(PyObject *UNUSED(self), PyObject *args) |
266 |
+ |
267 |
+ if ( !PyArg_ParseTuple(args,"ll",&nthCode, &altN) ) |
268 |
+ return( NULL ); |
269 |
+- return( Py_BuildValue("i", LigatureU_alt_getV(nthCode,altN)) ); |
270 |
++ return( Py_BuildValue("l", (long)LigatureU_alt_getV(nthCode,altN)) ); |
271 |
+ } |
272 |
+ |
273 |
+ static PyObject *PyFF_VulChartGetAltVal(PyObject *UNUSED(self), PyObject *args) { |
274 |
+@@ -1082,7 +1082,7 @@ static PyObject *PyFF_VulChartGetAltVal(PyObject *UNUSED(self), PyObject *args) |
275 |
+ |
276 |
+ if ( !PyArg_ParseTuple(args,"ll",&nthCode, &altN) ) |
277 |
+ return( NULL ); |
278 |
+- return( Py_BuildValue("i", VulgFrac_alt_getV(nthCode,altN)) ); |
279 |
++ return( Py_BuildValue("l", (long)VulgFrac_alt_getV(nthCode,altN)) ); |
280 |
+ } |
281 |
+ |
282 |
+ static PyObject *PyFF_VulChartUGetAltVal(PyObject *UNUSED(self), PyObject *args) { |
283 |
+@@ -1090,7 +1090,7 @@ static PyObject *PyFF_VulChartUGetAltVal(PyObject *UNUSED(self), PyObject *args) |
284 |
+ |
285 |
+ if ( !PyArg_ParseTuple(args,"ll",&nthCode, &altN) ) |
286 |
+ return( NULL ); |
287 |
+- return( Py_BuildValue("i", VulgFracU_alt_getV(nthCode,altN)) ); |
288 |
++ return( Py_BuildValue("l", (long)VulgFracU_alt_getV(nthCode,altN)) ); |
289 |
+ } |
290 |
+ |
291 |
+ static PyObject *PyFF_OFracChartGetAltVal(PyObject *UNUSED(self), PyObject *args) { |
292 |
+@@ -1098,7 +1098,7 @@ static PyObject *PyFF_OFracChartGetAltVal(PyObject *UNUSED(self), PyObject *args |
293 |
+ |
294 |
+ if ( !PyArg_ParseTuple(args,"ll",&nthCode, &altN) ) |
295 |
+ return( NULL ); |
296 |
+- return( Py_BuildValue("i", Fraction_alt_getV(nthCode,altN)) ); |
297 |
++ return( Py_BuildValue("l", (long)Fraction_alt_getV(nthCode,altN)) ); |
298 |
+ } |
299 |
+ |
300 |
+ static PyObject *PyFF_OFracChartUGetAltVal(PyObject *UNUSED(self), PyObject *args) { |
301 |
+@@ -1106,7 +1106,7 @@ static PyObject *PyFF_OFracChartUGetAltVal(PyObject *UNUSED(self), PyObject *arg |
302 |
+ |
303 |
+ if ( !PyArg_ParseTuple(args,"ll",&nthCode, &altN) ) |
304 |
+ return( NULL ); |
305 |
+- return( Py_BuildValue("i", FractionU_alt_getV(nthCode,altN)) ); |
306 |
++ return( Py_BuildValue("l", (long)FractionU_alt_getV(nthCode,altN)) ); |
307 |
+ } |
308 |
+ |
309 |
+ static PyObject *PyFF_Version(PyObject *UNUSED(self), PyObject *UNUSED(args)) { |
310 |
+@@ -1542,8 +1542,8 @@ return( ret ); |
311 |
+ } |
312 |
+ |
313 |
+ static PyObject *PyFF_scriptFromUnicode(PyObject *UNUSED(self), PyObject *args) { |
314 |
+- long u; |
315 |
+- if ( !PyArg_ParseTuple(args,"i",&u) ) |
316 |
++ unsigned long u; |
317 |
++ if ( !PyArg_ParseTuple(args,"k",&u) ) |
318 |
+ return( NULL ); |
319 |
+ |
320 |
+ uint32 script = ScriptFromUnicode(u, NULL); |
321 |
|
322 |
diff --git a/media-gfx/fontforge/fontforge-20200314.ebuild b/media-gfx/fontforge/fontforge-20200314.ebuild |
323 |
index ff049bda722..bc30b97aa32 100644 |
324 |
--- a/media-gfx/fontforge/fontforge-20200314.ebuild |
325 |
+++ b/media-gfx/fontforge/fontforge-20200314.ebuild |
326 |
@@ -55,6 +55,7 @@ BDEPEND=" |
327 |
PATCHES=( |
328 |
"${FILESDIR}"/20200314-stylemap.patch |
329 |
"${FILESDIR}"/20200314-tilepath.patch |
330 |
+ "${FILESDIR}"/20200314-big-endian.patch |
331 |
) |
332 |
|
333 |
pkg_setup() { |