fonttools 4.58.5__cp310-cp310-macosx_10_9_x86_64.whl → 4.59.1__cp310-cp310-macosx_10_9_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fonttools might be problematic. Click here for more details.

Files changed (67) hide show
  1. fontTools/__init__.py +1 -1
  2. fontTools/cffLib/CFF2ToCFF.py +40 -10
  3. fontTools/cffLib/transforms.py +11 -6
  4. fontTools/cu2qu/cu2qu.c +21 -6
  5. fontTools/cu2qu/cu2qu.cpython-310-darwin.so +0 -0
  6. fontTools/feaLib/builder.py +6 -1
  7. fontTools/feaLib/lexer.c +21 -6
  8. fontTools/feaLib/lexer.cpython-310-darwin.so +0 -0
  9. fontTools/merge/__init__.py +1 -1
  10. fontTools/misc/bezierTools.c +24 -9
  11. fontTools/misc/bezierTools.cpython-310-darwin.so +0 -0
  12. fontTools/misc/filesystem/__init__.py +68 -0
  13. fontTools/misc/filesystem/_base.py +134 -0
  14. fontTools/misc/filesystem/_copy.py +45 -0
  15. fontTools/misc/filesystem/_errors.py +54 -0
  16. fontTools/misc/filesystem/_info.py +75 -0
  17. fontTools/misc/filesystem/_osfs.py +164 -0
  18. fontTools/misc/filesystem/_path.py +67 -0
  19. fontTools/misc/filesystem/_subfs.py +92 -0
  20. fontTools/misc/filesystem/_tempfs.py +34 -0
  21. fontTools/misc/filesystem/_tools.py +34 -0
  22. fontTools/misc/filesystem/_walk.py +55 -0
  23. fontTools/misc/filesystem/_zipfs.py +204 -0
  24. fontTools/misc/psCharStrings.py +17 -2
  25. fontTools/misc/sstruct.py +2 -6
  26. fontTools/misc/xmlWriter.py +28 -1
  27. fontTools/pens/momentsPen.c +11 -4
  28. fontTools/pens/momentsPen.cpython-310-darwin.so +0 -0
  29. fontTools/pens/roundingPen.py +2 -2
  30. fontTools/qu2cu/qu2cu.c +23 -8
  31. fontTools/qu2cu/qu2cu.cpython-310-darwin.so +0 -0
  32. fontTools/subset/__init__.py +11 -11
  33. fontTools/ttLib/sfnt.py +2 -3
  34. fontTools/ttLib/tables/S__i_l_f.py +2 -2
  35. fontTools/ttLib/tables/T_S_I__1.py +2 -5
  36. fontTools/ttLib/tables/T_S_I__5.py +2 -2
  37. fontTools/ttLib/tables/_c_m_a_p.py +1 -1
  38. fontTools/ttLib/tables/_c_v_t.py +1 -2
  39. fontTools/ttLib/tables/_g_l_y_f.py +9 -10
  40. fontTools/ttLib/tables/_g_v_a_r.py +6 -3
  41. fontTools/ttLib/tables/_h_d_m_x.py +4 -4
  42. fontTools/ttLib/tables/_h_m_t_x.py +7 -3
  43. fontTools/ttLib/tables/_l_o_c_a.py +2 -2
  44. fontTools/ttLib/tables/_p_o_s_t.py +3 -4
  45. fontTools/ttLib/tables/otBase.py +2 -4
  46. fontTools/ttLib/tables/otTables.py +7 -12
  47. fontTools/ttLib/tables/sbixStrike.py +3 -3
  48. fontTools/ttLib/ttFont.py +7 -16
  49. fontTools/ttLib/woff2.py +10 -13
  50. fontTools/ufoLib/__init__.py +20 -25
  51. fontTools/ufoLib/glifLib.py +12 -17
  52. fontTools/ufoLib/validators.py +2 -4
  53. fontTools/unicodedata/__init__.py +2 -0
  54. fontTools/varLib/featureVars.py +8 -0
  55. fontTools/varLib/hvar.py +1 -1
  56. fontTools/varLib/instancer/__init__.py +65 -5
  57. fontTools/varLib/iup.c +23 -8
  58. fontTools/varLib/iup.cpython-310-darwin.so +0 -0
  59. fontTools/varLib/mutator.py +11 -0
  60. {fonttools-4.58.5.dist-info → fonttools-4.59.1.dist-info}/METADATA +42 -12
  61. {fonttools-4.58.5.dist-info → fonttools-4.59.1.dist-info}/RECORD +67 -55
  62. {fonttools-4.58.5.dist-info → fonttools-4.59.1.dist-info}/licenses/LICENSE.external +29 -0
  63. {fonttools-4.58.5.data → fonttools-4.59.1.data}/data/share/man/man1/ttx.1 +0 -0
  64. {fonttools-4.58.5.dist-info → fonttools-4.59.1.dist-info}/WHEEL +0 -0
  65. {fonttools-4.58.5.dist-info → fonttools-4.59.1.dist-info}/entry_points.txt +0 -0
  66. {fonttools-4.58.5.dist-info → fonttools-4.59.1.dist-info}/licenses/LICENSE +0 -0
  67. {fonttools-4.58.5.dist-info → fonttools-4.59.1.dist-info}/top_level.txt +0 -0
fontTools/__init__.py CHANGED
@@ -3,6 +3,6 @@ from fontTools.misc.loggingTools import configLogger
3
3
 
4
4
  log = logging.getLogger(__name__)
5
5
 
6
- version = __version__ = "4.58.5"
6
+ version = __version__ = "4.59.1"
7
7
 
8
8
  __all__ = ["version", "log", "configLogger"]
@@ -2,13 +2,17 @@
2
2
 
3
3
  from fontTools.ttLib import TTFont, newTable
4
4
  from fontTools.misc.cliTools import makeOutputFileName
5
+ from fontTools.misc.psCharStrings import T2StackUseExtractor
5
6
  from fontTools.cffLib import (
6
7
  TopDictIndex,
7
8
  buildOrder,
8
9
  buildDefaults,
9
10
  topDictOperators,
10
11
  privateDictOperators,
12
+ FDSelect,
11
13
  )
14
+ from .transforms import desubroutinizeCharString
15
+ from .specializer import specializeProgram
12
16
  from .width import optimizeWidths
13
17
  from collections import defaultdict
14
18
  import logging
@@ -27,7 +31,7 @@ def _convertCFF2ToCFF(cff, otFont):
27
31
  The CFF2 font cannot be variable. (TODO Accept those and convert to the
28
32
  default instance?)
29
33
 
30
- This assumes a decompiled CFF table. (i.e. that the object has been
34
+ This assumes a decompiled CFF2 table. (i.e. that the object has been
31
35
  filled via :meth:`decompile` and e.g. not loaded from XML.)"""
32
36
 
33
37
  cff.major = 1
@@ -51,9 +55,14 @@ def _convertCFF2ToCFF(cff, otFont):
51
55
  if hasattr(topDict, key):
52
56
  delattr(topDict, key)
53
57
 
54
- fdArray = topDict.FDArray
55
58
  charStrings = topDict.CharStrings
56
59
 
60
+ fdArray = topDict.FDArray
61
+ if not hasattr(topDict, "FDSelect"):
62
+ # FDSelect is optional in CFF2, but required in CFF.
63
+ fdSelect = topDict.FDSelect = FDSelect()
64
+ fdSelect.gidArray = [0] * len(charStrings.charStrings)
65
+
57
66
  defaults = buildDefaults(privateDictOperators)
58
67
  order = buildOrder(privateDictOperators)
59
68
  for fd in fdArray:
@@ -69,6 +78,7 @@ def _convertCFF2ToCFF(cff, otFont):
69
78
  if hasattr(privateDict, key):
70
79
  delattr(privateDict, key)
71
80
 
81
+ # Add ending operators
72
82
  for cs in charStrings.values():
73
83
  cs.decompile()
74
84
  cs.program.append("endchar")
@@ -100,23 +110,43 @@ def _convertCFF2ToCFF(cff, otFont):
100
110
  if width != private.defaultWidthX:
101
111
  cs.program.insert(0, width - private.nominalWidthX)
102
112
 
113
+ # Handle stack use since stack-depth is lower in CFF than in CFF2.
114
+ for glyphName in charStrings.keys():
115
+ cs, fdIndex = charStrings.getItemAndSelector(glyphName)
116
+ if fdIndex is None:
117
+ fdIndex = 0
118
+ private = fdArray[fdIndex].Private
119
+ extractor = T2StackUseExtractor(
120
+ getattr(private, "Subrs", []), cff.GlobalSubrs, private=private
121
+ )
122
+ stackUse = extractor.execute(cs)
123
+ if stackUse > 48: # CFF stack depth is 48
124
+ desubroutinizeCharString(cs)
125
+ cs.program = specializeProgram(cs.program)
126
+
127
+ # Unused subroutines are still in CFF2 (ie. lacking 'return' operator)
128
+ # because they were not decompiled when we added the 'return'.
129
+ # Moreover, some used subroutines may have become unused after the
130
+ # stack-use fixup. So we remove all unused subroutines now.
131
+ cff.remove_unused_subroutines()
132
+
103
133
  mapping = {
104
- name: ("cid" + str(n) if n else ".notdef")
134
+ name: ("cid" + str(n).zfill(5) if n else ".notdef")
105
135
  for n, name in enumerate(topDict.charset)
106
136
  }
107
137
  topDict.charset = [
108
- "cid" + str(n) if n else ".notdef" for n in range(len(topDict.charset))
138
+ "cid" + str(n).zfill(5) if n else ".notdef" for n in range(len(topDict.charset))
109
139
  ]
110
140
  charStrings.charStrings = {
111
141
  mapping[name]: v for name, v in charStrings.charStrings.items()
112
142
  }
113
143
 
114
- # I'm not sure why the following is *not* necessary. And it breaks
115
- # the output if I add it.
116
- # topDict.ROS = ("Adobe", "Identity", 0)
144
+ topDict.ROS = ("Adobe", "Identity", 0)
117
145
 
118
146
 
119
147
  def convertCFF2ToCFF(font, *, updatePostTable=True):
148
+ if "CFF2" not in font:
149
+ raise ValueError("Input font does not contain a CFF2 table.")
120
150
  cff = font["CFF2"].cff
121
151
  _convertCFF2ToCFF(cff, font)
122
152
  del font["CFF2"]
@@ -131,7 +161,7 @@ def convertCFF2ToCFF(font, *, updatePostTable=True):
131
161
 
132
162
 
133
163
  def main(args=None):
134
- """Convert CFF OTF font to CFF2 OTF font"""
164
+ """Convert CFF2 OTF font to CFF OTF font"""
135
165
  if args is None:
136
166
  import sys
137
167
 
@@ -140,8 +170,8 @@ def main(args=None):
140
170
  import argparse
141
171
 
142
172
  parser = argparse.ArgumentParser(
143
- "fonttools cffLib.CFFToCFF2",
144
- description="Upgrade a CFF font to CFF2.",
173
+ "fonttools cffLib.CFF2ToCFF",
174
+ description="Convert a non-variable CFF2 font to CFF.",
145
175
  )
146
176
  parser.add_argument(
147
177
  "input", metavar="INPUT.ttf", help="Input OTF file with CFF table."
@@ -94,17 +94,22 @@ class _DesubroutinizingT2Decompiler(SimpleT2Decompiler):
94
94
  cs._patches.append((index, subr._desubroutinized))
95
95
 
96
96
 
97
+ def desubroutinizeCharString(cs):
98
+ """Desubroutinize a charstring in-place."""
99
+ cs.decompile()
100
+ subrs = getattr(cs.private, "Subrs", [])
101
+ decompiler = _DesubroutinizingT2Decompiler(subrs, cs.globalSubrs, cs.private)
102
+ decompiler.execute(cs)
103
+ cs.program = cs._desubroutinized
104
+ del cs._desubroutinized
105
+
106
+
97
107
  def desubroutinize(cff):
98
108
  for fontName in cff.fontNames:
99
109
  font = cff[fontName]
100
110
  cs = font.CharStrings
101
111
  for c in cs.values():
102
- c.decompile()
103
- subrs = getattr(c.private, "Subrs", [])
104
- decompiler = _DesubroutinizingT2Decompiler(subrs, c.globalSubrs, c.private)
105
- decompiler.execute(c)
106
- c.program = c._desubroutinized
107
- del c._desubroutinized
112
+ desubroutinizeCharString(c)
108
113
  # Delete all the local subrs
109
114
  if hasattr(font, "FDArray"):
110
115
  for fd in font.FDArray:
fontTools/cu2qu/cu2qu.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.1.2 */
1
+ /* Generated by Cython 3.1.3 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -32,8 +32,8 @@ END: Cython Metadata */
32
32
  #elif PY_VERSION_HEX < 0x03080000
33
33
  #error Cython requires Python 3.8+.
34
34
  #else
35
- #define __PYX_ABI_VERSION "3_1_2"
36
- #define CYTHON_HEX_VERSION 0x030102F0
35
+ #define __PYX_ABI_VERSION "3_1_3"
36
+ #define CYTHON_HEX_VERSION 0x030103F0
37
37
  #define CYTHON_FUTURE_DIVISION 1
38
38
  /* CModulePreamble */
39
39
  #include <stddef.h>
@@ -396,6 +396,9 @@ END: Cython Metadata */
396
396
  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
397
397
  #endif
398
398
  #endif
399
+ #ifndef CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME
400
+ #define CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME 100
401
+ #endif
399
402
  #ifndef __has_attribute
400
403
  #define __has_attribute(x) 0
401
404
  #endif
@@ -10305,6 +10308,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
10305
10308
  changed = 1;
10306
10309
  }
10307
10310
  #endif // CYTHON_METH_FASTCALL
10311
+ #if !CYTHON_COMPILING_IN_PYPY
10308
10312
  else if (strcmp(memb->name, "__module__") == 0) {
10309
10313
  PyObject *descr;
10310
10314
  assert(memb->type == T_OBJECT);
@@ -10319,11 +10323,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
10319
10323
  }
10320
10324
  changed = 1;
10321
10325
  }
10326
+ #endif // !CYTHON_COMPILING_IN_PYPY
10322
10327
  }
10323
10328
  memb++;
10324
10329
  }
10325
10330
  }
10326
10331
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
10332
+ #if !CYTHON_COMPILING_IN_PYPY
10327
10333
  slot = spec->slots;
10328
10334
  while (slot && slot->slot && slot->slot != Py_tp_getset)
10329
10335
  slot++;
@@ -10355,6 +10361,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
10355
10361
  ++getset;
10356
10362
  }
10357
10363
  }
10364
+ #endif // !CYTHON_COMPILING_IN_PYPY
10358
10365
  if (changed)
10359
10366
  PyType_Modified(type);
10360
10367
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -10465,6 +10472,13 @@ try_unpack:
10465
10472
 
10466
10473
  /* PyObjectCallMethod0 */
10467
10474
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
10475
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
10476
+ PyObject *args[1] = {obj};
10477
+ (void) __Pyx_PyObject_GetMethod;
10478
+ (void) __Pyx_PyObject_CallOneArg;
10479
+ (void) __Pyx_PyObject_CallNoArg;
10480
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
10481
+ #else
10468
10482
  PyObject *method = NULL, *result = NULL;
10469
10483
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
10470
10484
  if (likely(is_method)) {
@@ -10477,6 +10491,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
10477
10491
  Py_DECREF(method);
10478
10492
  bad:
10479
10493
  return result;
10494
+ #endif
10480
10495
  }
10481
10496
 
10482
10497
  /* ValidateBasesTuple */
@@ -11088,7 +11103,7 @@ bad:
11088
11103
  }
11089
11104
 
11090
11105
  /* CommonTypesMetaclass */
11091
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
11106
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
11092
11107
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
11093
11108
  }
11094
11109
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
@@ -13654,7 +13669,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyOb
13654
13669
  }
13655
13670
 
13656
13671
  /* PyObjectCallMethod1 */
13657
- #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
13672
+ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
13658
13673
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
13659
13674
  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
13660
13675
  Py_DECREF(method);
@@ -13662,7 +13677,7 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
13662
13677
  }
13663
13678
  #endif
13664
13679
  static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
13665
- #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
13680
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
13666
13681
  PyObject *args[2] = {obj, arg};
13667
13682
  (void) __Pyx_PyObject_GetMethod;
13668
13683
  (void) __Pyx_PyObject_CallOneArg;
Binary file
@@ -926,6 +926,11 @@ class Builder(object):
926
926
  l.lookup_index for l in lookups if l.lookup_index is not None
927
927
  )
928
928
  )
929
+ # order doesn't matter, but lookup_indices preserves it.
930
+ # We want to combine identical sets of lookups (order doesn't matter)
931
+ # but also respect the order provided by the user (although there's
932
+ # a reasonable argument to just sort and dedupe, which fontc does)
933
+ lookup_key = frozenset(lookup_indices)
929
934
 
930
935
  size_feature = tag == "GPOS" and feature_tag == "size"
931
936
  force_feature = self.any_feature_variations(feature_tag, tag)
@@ -943,7 +948,7 @@ class Builder(object):
943
948
  "stash debug information. See fonttools#2065."
944
949
  )
945
950
 
946
- feature_key = (feature_tag, lookup_indices)
951
+ feature_key = (feature_tag, lookup_key)
947
952
  feature_index = feature_indices.get(feature_key)
948
953
  if feature_index is None:
949
954
  feature_index = len(table.FeatureList.FeatureRecord)
fontTools/feaLib/lexer.c CHANGED
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.1.2 */
1
+ /* Generated by Cython 3.1.3 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -26,8 +26,8 @@ END: Cython Metadata */
26
26
  #elif PY_VERSION_HEX < 0x03080000
27
27
  #error Cython requires Python 3.8+.
28
28
  #else
29
- #define __PYX_ABI_VERSION "3_1_2"
30
- #define CYTHON_HEX_VERSION 0x030102F0
29
+ #define __PYX_ABI_VERSION "3_1_3"
30
+ #define CYTHON_HEX_VERSION 0x030103F0
31
31
  #define CYTHON_FUTURE_DIVISION 1
32
32
  /* CModulePreamble */
33
33
  #include <stddef.h>
@@ -390,6 +390,9 @@ END: Cython Metadata */
390
390
  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
391
391
  #endif
392
392
  #endif
393
+ #ifndef CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME
394
+ #define CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME 100
395
+ #endif
393
396
  #ifndef __has_attribute
394
397
  #define __has_attribute(x) 0
395
398
  #endif
@@ -13414,6 +13417,13 @@ try_unpack:
13414
13417
 
13415
13418
  /* PyObjectCallMethod0 */
13416
13419
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
13420
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
13421
+ PyObject *args[1] = {obj};
13422
+ (void) __Pyx_PyObject_GetMethod;
13423
+ (void) __Pyx_PyObject_CallOneArg;
13424
+ (void) __Pyx_PyObject_CallNoArg;
13425
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
13426
+ #else
13417
13427
  PyObject *method = NULL, *result = NULL;
13418
13428
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
13419
13429
  if (likely(is_method)) {
@@ -13426,6 +13436,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
13426
13436
  Py_DECREF(method);
13427
13437
  bad:
13428
13438
  return result;
13439
+ #endif
13429
13440
  }
13430
13441
 
13431
13442
  /* CallUnboundCMethod0 */
@@ -13493,7 +13504,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyOb
13493
13504
  }
13494
13505
 
13495
13506
  /* PyObjectCallMethod1 */
13496
- #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
13507
+ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
13497
13508
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
13498
13509
  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
13499
13510
  Py_DECREF(method);
@@ -13501,7 +13512,7 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
13501
13512
  }
13502
13513
  #endif
13503
13514
  static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
13504
- #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
13515
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
13505
13516
  PyObject *args[2] = {obj, arg};
13506
13517
  (void) __Pyx_PyObject_GetMethod;
13507
13518
  (void) __Pyx_PyObject_CallOneArg;
@@ -14087,6 +14098,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14087
14098
  changed = 1;
14088
14099
  }
14089
14100
  #endif // CYTHON_METH_FASTCALL
14101
+ #if !CYTHON_COMPILING_IN_PYPY
14090
14102
  else if (strcmp(memb->name, "__module__") == 0) {
14091
14103
  PyObject *descr;
14092
14104
  assert(memb->type == T_OBJECT);
@@ -14101,11 +14113,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14101
14113
  }
14102
14114
  changed = 1;
14103
14115
  }
14116
+ #endif // !CYTHON_COMPILING_IN_PYPY
14104
14117
  }
14105
14118
  memb++;
14106
14119
  }
14107
14120
  }
14108
14121
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
14122
+ #if !CYTHON_COMPILING_IN_PYPY
14109
14123
  slot = spec->slots;
14110
14124
  while (slot && slot->slot && slot->slot != Py_tp_getset)
14111
14125
  slot++;
@@ -14137,6 +14151,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14137
14151
  ++getset;
14138
14152
  }
14139
14153
  }
14154
+ #endif // !CYTHON_COMPILING_IN_PYPY
14140
14155
  if (changed)
14141
14156
  PyType_Modified(type);
14142
14157
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -14269,7 +14284,7 @@ bad:
14269
14284
  }
14270
14285
 
14271
14286
  /* CommonTypesMetaclass */
14272
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
14287
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
14273
14288
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
14274
14289
  }
14275
14290
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
@@ -196,7 +196,7 @@ def main(args=None):
196
196
 
197
197
  if len(fontfiles) < 1:
198
198
  print(
199
- "usage: pyftmerge [font1 ... fontN] [--input-file=filelist.txt] [--output-file=merged.ttf] [--import-file=tables.ttx]",
199
+ "usage: fonttools merge [font1 ... fontN] [--input-file=filelist.txt] [--output-file=merged.ttf] [--import-file=tables.ttx]",
200
200
  file=sys.stderr,
201
201
  )
202
202
  print(
@@ -1,4 +1,4 @@
1
- /* Generated by Cython 3.1.2 */
1
+ /* Generated by Cython 3.1.3 */
2
2
 
3
3
  /* BEGIN: Cython Metadata
4
4
  {
@@ -26,8 +26,8 @@ END: Cython Metadata */
26
26
  #elif PY_VERSION_HEX < 0x03080000
27
27
  #error Cython requires Python 3.8+.
28
28
  #else
29
- #define __PYX_ABI_VERSION "3_1_2"
30
- #define CYTHON_HEX_VERSION 0x030102F0
29
+ #define __PYX_ABI_VERSION "3_1_3"
30
+ #define CYTHON_HEX_VERSION 0x030103F0
31
31
  #define CYTHON_FUTURE_DIVISION 1
32
32
  /* CModulePreamble */
33
33
  #include <stddef.h>
@@ -390,6 +390,9 @@ END: Cython Metadata */
390
390
  enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
391
391
  #endif
392
392
  #endif
393
+ #ifndef CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME
394
+ #define CYTHON_LOCK_AND_GIL_DEADLOCK_AVOIDANCE_TIME 100
395
+ #endif
393
396
  #ifndef __has_attribute
394
397
  #define __has_attribute(x) 0
395
398
  #endif
@@ -2390,7 +2393,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyLong_AddObjC(PyObject *op1, PyObject *op2
2390
2393
  static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
2391
2394
  #define __Pyx_PyNumber_Absolute(x)\
2392
2395
  ((likely(PyLong_CheckExact(x))) ?\
2393
- (likely(__Pyx_PyLong_IsNonNeg(x)) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
2396
+ (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
2394
2397
  PyNumber_Absolute(x))
2395
2398
  #else
2396
2399
  #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
@@ -3261,7 +3264,7 @@ static const char __pyx_k_segmentPointAtT[] = "segmentPointAtT";
3261
3264
  static const char __pyx_k_splitCubicAtT_2[] = "splitCubicAtT";
3262
3265
  static const char __pyx_k_transformPoints[] = "transformPoints";
3263
3266
  static const char __pyx_k_1_a_r_wb_gRvWBfA[] = "\320\000+\2501\360\034\000\005\014\320\013\036\230a\330\010\017\210r\220\026\220w\230b\240\006\240g\250R\250v\260W\270B\270f\300A";
3264
- static const char __pyx_k_s_3c_A_AS_1_b_AQ[] = "\200\001\330\004\007\200s\210!\2103\210c\220\021\330\010\017\320\017\"\240\"\240A\330\t\014\210A\210S\220\003\2201\330\010\017\210\230b\240\001\330\004\n\210*\220A\220Q";
3267
+ static const char __pyx_k_s_3c_A_AS_1_b_AQ[] = "\200\001\330\004\007\200s\210!\2103\210c\220\021\330\010\017\320\017\"\240\"\240A\330\t\014\210A\210S\220\003\2201\330\010\017\210\177\230b\240\001\330\004\n\210*\220A\220Q";
3265
3268
  static const char __pyx_k_splitCubicAtTC_2[] = "_splitCubicAtTC";
3266
3269
  static const char __pyx_k_quadraticPointAtT[] = "quadraticPointAtT";
3267
3270
  static const char __pyx_k_splitQuadraticAtT[] = "_splitQuadraticAtT";
@@ -34135,6 +34138,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
34135
34138
  changed = 1;
34136
34139
  }
34137
34140
  #endif // CYTHON_METH_FASTCALL
34141
+ #if !CYTHON_COMPILING_IN_PYPY
34138
34142
  else if (strcmp(memb->name, "__module__") == 0) {
34139
34143
  PyObject *descr;
34140
34144
  assert(memb->type == T_OBJECT);
@@ -34149,11 +34153,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
34149
34153
  }
34150
34154
  changed = 1;
34151
34155
  }
34156
+ #endif // !CYTHON_COMPILING_IN_PYPY
34152
34157
  }
34153
34158
  memb++;
34154
34159
  }
34155
34160
  }
34156
34161
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
34162
+ #if !CYTHON_COMPILING_IN_PYPY
34157
34163
  slot = spec->slots;
34158
34164
  while (slot && slot->slot && slot->slot != Py_tp_getset)
34159
34165
  slot++;
@@ -34185,6 +34191,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
34185
34191
  ++getset;
34186
34192
  }
34187
34193
  }
34194
+ #endif // !CYTHON_COMPILING_IN_PYPY
34188
34195
  if (changed)
34189
34196
  PyType_Modified(type);
34190
34197
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -34317,7 +34324,7 @@ bad:
34317
34324
  }
34318
34325
 
34319
34326
  /* CommonTypesMetaclass */
34320
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
34327
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
34321
34328
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
34322
34329
  }
34323
34330
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
@@ -34735,7 +34742,7 @@ try_unpack:
34735
34742
  }
34736
34743
 
34737
34744
  /* PyObjectCallMethod1 */
34738
- #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
34745
+ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
34739
34746
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
34740
34747
  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
34741
34748
  Py_DECREF(method);
@@ -34743,7 +34750,7 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
34743
34750
  }
34744
34751
  #endif
34745
34752
  static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
34746
- #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
34753
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
34747
34754
  PyObject *args[2] = {obj, arg};
34748
34755
  (void) __Pyx_PyObject_GetMethod;
34749
34756
  (void) __Pyx_PyObject_CallOneArg;
@@ -36076,7 +36083,7 @@ static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
36076
36083
  PyObject *copy = _PyLong_Copy((PyLongObject*)n);
36077
36084
  if (likely(copy)) {
36078
36085
  #if PY_VERSION_HEX >= 0x030C00A7
36079
- ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
36086
+ ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
36080
36087
  #else
36081
36088
  __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
36082
36089
  #endif
@@ -37773,6 +37780,13 @@ static CYTHON_INLINE int __Pyx_PySet_ContainsTF(PyObject* key, PyObject* set, in
37773
37780
 
37774
37781
  /* PyObjectCallMethod0 */
37775
37782
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
37783
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
37784
+ PyObject *args[1] = {obj};
37785
+ (void) __Pyx_PyObject_GetMethod;
37786
+ (void) __Pyx_PyObject_CallOneArg;
37787
+ (void) __Pyx_PyObject_CallNoArg;
37788
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
37789
+ #else
37776
37790
  PyObject *method = NULL, *result = NULL;
37777
37791
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
37778
37792
  if (likely(is_method)) {
@@ -37785,6 +37799,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
37785
37799
  Py_DECREF(method);
37786
37800
  bad:
37787
37801
  return result;
37802
+ #endif
37788
37803
  }
37789
37804
 
37790
37805
  /* ValidateBasesTuple */
@@ -0,0 +1,68 @@
1
+ """Minimal, stdlib-only replacement for [`pyfilesystem2`][1] API for use by `fontTools.ufoLib`.
2
+
3
+ This package is a partial reimplementation of the `fs` package by Will McGugan, used under the
4
+ MIT license. See LICENSE.external for details.
5
+
6
+ Note this only exports a **subset** of the `pyfilesystem2` API, in particular the modules,
7
+ classes and functions that are currently used directly by `fontTools.ufoLib`.
8
+
9
+ It opportunistically tries to import the relevant modules from the upstream `fs` package
10
+ when this is available. Otherwise it falls back to the replacement modules within this package.
11
+
12
+ As of version 4.59.0, the `fonttools[ufo]` extra no longer requires the `fs` package, thus
13
+ this `fontTools.misc.filesystem` package is used by default.
14
+
15
+ Client code can either replace `import fs` with `from fontTools.misc import filesystem as fs`
16
+ if that happens to work (no guarantee), or they can continue to use `fs` but they will have
17
+ to specify it as an explicit dependency of their project.
18
+
19
+ [1]: https://github.com/PyFilesystem/pyfilesystem2
20
+ """
21
+
22
+ from __future__ import annotations
23
+
24
+ try:
25
+ __import__("fs")
26
+ except ImportError:
27
+ from . import _base as base
28
+ from . import _copy as copy
29
+ from . import _errors as errors
30
+ from . import _info as info
31
+ from . import _osfs as osfs
32
+ from . import _path as path
33
+ from . import _subfs as subfs
34
+ from . import _tempfs as tempfs
35
+ from . import _tools as tools
36
+ from . import _walk as walk
37
+ from . import _zipfs as zipfs
38
+
39
+ _haveFS = False
40
+ else:
41
+ import fs.base as base
42
+ import fs.copy as copy
43
+ import fs.errors as errors
44
+ import fs.info as info
45
+ import fs.osfs as osfs
46
+ import fs.path as path
47
+ import fs.subfs as subfs
48
+ import fs.tempfs as tempfs
49
+ import fs.tools as tools
50
+ import fs.walk as walk
51
+ import fs.zipfs as zipfs
52
+
53
+ _haveFS = True
54
+
55
+
56
+ __all__ = [
57
+ "base",
58
+ "copy",
59
+ "errors",
60
+ "info",
61
+ "osfs",
62
+ "path",
63
+ "subfs",
64
+ "tempfs",
65
+ "tools",
66
+ "walk",
67
+ "zipfs",
68
+ ]