fonttools 4.59.0__cp39-cp39-macosx_10_9_universal2.whl → 4.59.1__cp39-cp39-macosx_10_9_universal2.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 (30) 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-39-darwin.so +0 -0
  6. fontTools/feaLib/builder.py +6 -1
  7. fontTools/feaLib/lexer.c +21 -6
  8. fontTools/feaLib/lexer.cpython-39-darwin.so +0 -0
  9. fontTools/misc/bezierTools.c +24 -9
  10. fontTools/misc/bezierTools.cpython-39-darwin.so +0 -0
  11. fontTools/misc/psCharStrings.py +17 -2
  12. fontTools/pens/momentsPen.c +11 -4
  13. fontTools/pens/momentsPen.cpython-39-darwin.so +0 -0
  14. fontTools/qu2cu/qu2cu.c +23 -8
  15. fontTools/qu2cu/qu2cu.cpython-39-darwin.so +0 -0
  16. fontTools/ttLib/tables/_g_v_a_r.py +6 -3
  17. fontTools/ttLib/tables/_h_m_t_x.py +7 -3
  18. fontTools/varLib/featureVars.py +8 -0
  19. fontTools/varLib/instancer/__init__.py +65 -5
  20. fontTools/varLib/iup.c +23 -8
  21. fontTools/varLib/iup.cpython-39-darwin.so +0 -0
  22. fontTools/varLib/mutator.py +11 -0
  23. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/METADATA +24 -10
  24. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/RECORD +30 -30
  25. {fonttools-4.59.0.data → fonttools-4.59.1.data}/data/share/man/man1/ttx.1 +0 -0
  26. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/WHEEL +0 -0
  27. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/entry_points.txt +0 -0
  28. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/licenses/LICENSE +0 -0
  29. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/licenses/LICENSE.external +0 -0
  30. {fonttools-4.59.0.dist-info → fonttools-4.59.1.dist-info}/top_level.txt +0 -0
fontTools/qu2cu/qu2cu.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
@@ -1963,7 +1966,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject
1963
1966
  static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
1964
1967
  #define __Pyx_PyNumber_Absolute(x)\
1965
1968
  ((likely(PyLong_CheckExact(x))) ?\
1966
- (likely(__Pyx_PyLong_IsNonNeg(x)) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
1969
+ (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
1967
1970
  PyNumber_Absolute(x))
1968
1971
  #else
1969
1972
  #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
@@ -10557,7 +10560,7 @@ static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
10557
10560
  PyObject *copy = _PyLong_Copy((PyLongObject*)n);
10558
10561
  if (likely(copy)) {
10559
10562
  #if PY_VERSION_HEX >= 0x030C00A7
10560
- ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
10563
+ ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
10561
10564
  #else
10562
10565
  __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
10563
10566
  #endif
@@ -11193,6 +11196,13 @@ try_unpack:
11193
11196
 
11194
11197
  /* PyObjectCallMethod0 */
11195
11198
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
11199
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
11200
+ PyObject *args[1] = {obj};
11201
+ (void) __Pyx_PyObject_GetMethod;
11202
+ (void) __Pyx_PyObject_CallOneArg;
11203
+ (void) __Pyx_PyObject_CallNoArg;
11204
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
11205
+ #else
11196
11206
  PyObject *method = NULL, *result = NULL;
11197
11207
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
11198
11208
  if (likely(is_method)) {
@@ -11205,6 +11215,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
11205
11215
  Py_DECREF(method);
11206
11216
  bad:
11207
11217
  return result;
11218
+ #endif
11208
11219
  }
11209
11220
 
11210
11221
  /* CallUnboundCMethod0 */
@@ -11742,6 +11753,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
11742
11753
  changed = 1;
11743
11754
  }
11744
11755
  #endif // CYTHON_METH_FASTCALL
11756
+ #if !CYTHON_COMPILING_IN_PYPY
11745
11757
  else if (strcmp(memb->name, "__module__") == 0) {
11746
11758
  PyObject *descr;
11747
11759
  assert(memb->type == T_OBJECT);
@@ -11756,11 +11768,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
11756
11768
  }
11757
11769
  changed = 1;
11758
11770
  }
11771
+ #endif // !CYTHON_COMPILING_IN_PYPY
11759
11772
  }
11760
11773
  memb++;
11761
11774
  }
11762
11775
  }
11763
11776
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
11777
+ #if !CYTHON_COMPILING_IN_PYPY
11764
11778
  slot = spec->slots;
11765
11779
  while (slot && slot->slot && slot->slot != Py_tp_getset)
11766
11780
  slot++;
@@ -11792,6 +11806,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
11792
11806
  ++getset;
11793
11807
  }
11794
11808
  }
11809
+ #endif // !CYTHON_COMPILING_IN_PYPY
11795
11810
  if (changed)
11796
11811
  PyType_Modified(type);
11797
11812
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -12227,7 +12242,7 @@ bad:
12227
12242
  }
12228
12243
 
12229
12244
  /* CommonTypesMetaclass */
12230
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
12245
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
12231
12246
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
12232
12247
  }
12233
12248
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
@@ -14847,7 +14862,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyOb
14847
14862
  }
14848
14863
 
14849
14864
  /* PyObjectCallMethod1 */
14850
- #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
14865
+ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
14851
14866
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
14852
14867
  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
14853
14868
  Py_DECREF(method);
@@ -14855,7 +14870,7 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
14855
14870
  }
14856
14871
  #endif
14857
14872
  static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
14858
- #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
14873
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
14859
14874
  PyObject *args[2] = {obj, arg};
14860
14875
  (void) __Pyx_PyObject_GetMethod;
14861
14876
  (void) __Pyx_PyObject_CallOneArg;
Binary file
@@ -64,7 +64,6 @@ class table__g_v_a_r(DefaultTable.DefaultTable):
64
64
  self.variations = {}
65
65
 
66
66
  def compile(self, ttFont):
67
-
68
67
  axisTags = [axis.axisTag for axis in ttFont["fvar"].axes]
69
68
  sharedTuples = tv.compileSharedTuples(
70
69
  axisTags, itertools.chain(*self.variations.values())
@@ -141,8 +140,12 @@ class table__g_v_a_r(DefaultTable.DefaultTable):
141
140
  self,
142
141
  )
143
142
 
144
- assert len(glyphs) == self.glyphCount
145
- assert len(axisTags) == self.axisCount
143
+ assert len(glyphs) == self.glyphCount, (len(glyphs), self.glyphCount)
144
+ assert len(axisTags) == self.axisCount, (
145
+ len(axisTags),
146
+ self.axisCount,
147
+ axisTags,
148
+ )
146
149
  sharedCoords = tv.decompileSharedTuples(
147
150
  axisTags, self.sharedTupleCount, data, self.offsetToSharedTuples
148
151
  )
@@ -40,15 +40,19 @@ class table__h_m_t_x(DefaultTable.DefaultTable):
40
40
  % (self.headerTag, self.numberOfMetricsName)
41
41
  )
42
42
  numberOfMetrics = numGlyphs
43
- if len(data) < 4 * numberOfMetrics:
44
- raise ttLib.TTLibError("not enough '%s' table data" % self.tableTag)
43
+ numberOfSideBearings = numGlyphs - numberOfMetrics
44
+ tableSize = 4 * numberOfMetrics + 2 * numberOfSideBearings
45
+ if len(data) < tableSize:
46
+ raise ttLib.TTLibError(
47
+ f"not enough '{self.tableTag}' table data: "
48
+ f"expected {tableSize} bytes, got {len(data)}"
49
+ )
45
50
  # Note: advanceWidth is unsigned, but some font editors might
46
51
  # read/write as signed. We can't be sure whether it was a mistake
47
52
  # or not, so we read as unsigned but also issue a warning...
48
53
  metricsFmt = ">" + self.longMetricFormat * numberOfMetrics
49
54
  metrics = struct.unpack(metricsFmt, data[: 4 * numberOfMetrics])
50
55
  data = data[4 * numberOfMetrics :]
51
- numberOfSideBearings = numGlyphs - numberOfMetrics
52
56
  sideBearings = array.array("h", data[: 2 * numberOfSideBearings])
53
57
  data = data[2 * numberOfSideBearings :]
54
58
 
@@ -95,6 +95,14 @@ def addFeatureVariations(font, conditionalSubstitutions, featureTag="rvrn"):
95
95
 
96
96
  addFeatureVariationsRaw(font, font["GSUB"].table, conditionsAndLookups, featureTags)
97
97
 
98
+ # Update OS/2.usMaxContext in case the font didn't have features before, but
99
+ # does now, if the OS/2 table exists. The table may be required, but
100
+ # fontTools needs to be able to deal with non-standard fonts. Since feature
101
+ # variations are always 1:1 mappings, we can set the value to at least 1
102
+ # instead of recomputing it with `otlLib.maxContextCalc.maxCtxFont()`.
103
+ if (os2 := font.get("OS/2")) is not None:
104
+ os2.usMaxContext = max(1, os2.usMaxContext)
105
+
98
106
 
99
107
  def _existingVariableFeatures(table):
100
108
  existingFeatureVarsTags = set()
@@ -120,6 +120,7 @@ from fontTools.cffLib.specializer import (
120
120
  specializeCommands,
121
121
  generalizeCommands,
122
122
  )
123
+ from fontTools.cffLib.CFF2ToCFF import convertCFF2ToCFF
123
124
  from fontTools.varLib import builder
124
125
  from fontTools.varLib.mvar import MVAR_ENTRIES
125
126
  from fontTools.varLib.merger import MutatorMerger
@@ -136,6 +137,7 @@ from enum import IntEnum
136
137
  import logging
137
138
  import os
138
139
  import re
140
+ import io
139
141
  from typing import Dict, Iterable, Mapping, Optional, Sequence, Tuple, Union
140
142
  import warnings
141
143
 
@@ -643,7 +645,11 @@ def instantiateCFF2(
643
645
  # the Private dicts.
644
646
  #
645
647
  # Then prune unused things and possibly drop the VarStore if it's empty.
646
- # In which case, downgrade to CFF table if requested.
648
+ #
649
+ # If the downgrade parameter is True, no actual downgrading is done, but
650
+ # the function returns True if the VarStore was empty after instantiation,
651
+ # and hence a downgrade to CFF is possible. In all other cases it returns
652
+ # False.
647
653
 
648
654
  log.info("Instantiating CFF2 table")
649
655
 
@@ -882,9 +888,9 @@ def instantiateCFF2(
882
888
  del private.vstore
883
889
 
884
890
  if downgrade:
885
- from fontTools.cffLib.CFF2ToCFF import convertCFF2ToCFF
891
+ return True
886
892
 
887
- convertCFF2ToCFF(varfont)
893
+ return False
888
894
 
889
895
 
890
896
  def _instantiateGvarGlyph(
@@ -1377,6 +1383,52 @@ def _isValidAvarSegmentMap(axisTag, segmentMap):
1377
1383
  return True
1378
1384
 
1379
1385
 
1386
+ def downgradeCFF2ToCFF(varfont):
1387
+
1388
+ # Save these properties
1389
+ recalcTimestamp = varfont.recalcTimestamp
1390
+ recalcBBoxes = varfont.recalcBBoxes
1391
+
1392
+ # Disable them
1393
+ varfont.recalcTimestamp = False
1394
+ varfont.recalcBBoxes = False
1395
+
1396
+ # Save to memory, reload, downgrade and save again, reload.
1397
+ # We do this dance because the convertCFF2ToCFF changes glyph
1398
+ # names, so following save would fail if any other table was
1399
+ # loaded and referencing glyph names.
1400
+ #
1401
+ # The second save+load is unfortunate but also necessary.
1402
+
1403
+ stream = io.BytesIO()
1404
+ log.info("Saving CFF2 font to memory for downgrade")
1405
+ varfont.save(stream)
1406
+ stream.seek(0)
1407
+ varfont = TTFont(stream, recalcTimestamp=False, recalcBBoxes=False)
1408
+
1409
+ convertCFF2ToCFF(varfont)
1410
+
1411
+ stream = io.BytesIO()
1412
+ log.info("Saving downgraded CFF font to memory")
1413
+ varfont.save(stream)
1414
+ stream.seek(0)
1415
+ varfont = TTFont(stream, recalcTimestamp=False, recalcBBoxes=False)
1416
+
1417
+ # Uncomment, to see test all tables can be loaded. This fails without
1418
+ # the extra save+load above.
1419
+ """
1420
+ for tag in varfont.keys():
1421
+ print("Loading", tag)
1422
+ varfont[tag]
1423
+ """
1424
+
1425
+ # Restore them
1426
+ varfont.recalcTimestamp = recalcTimestamp
1427
+ varfont.recalcBBoxes = recalcBBoxes
1428
+
1429
+ return varfont
1430
+
1431
+
1380
1432
  def instantiateAvar(varfont, axisLimits):
1381
1433
  # 'axisLimits' dict must contain user-space (non-normalized) coordinates.
1382
1434
 
@@ -1665,7 +1717,9 @@ def instantiateVariableFont(
1665
1717
  instantiateVARC(varfont, normalizedLimits)
1666
1718
 
1667
1719
  if "CFF2" in varfont:
1668
- instantiateCFF2(varfont, normalizedLimits, downgrade=downgradeCFF2)
1720
+ downgradeCFF2 = instantiateCFF2(
1721
+ varfont, normalizedLimits, downgrade=downgradeCFF2
1722
+ )
1669
1723
 
1670
1724
  if "gvar" in varfont:
1671
1725
  instantiateGvar(varfont, normalizedLimits, optimize=optimize)
@@ -1720,6 +1774,12 @@ def instantiateVariableFont(
1720
1774
  # name table has been updated.
1721
1775
  setRibbiBits(varfont)
1722
1776
 
1777
+ if downgradeCFF2:
1778
+ origVarfont = varfont
1779
+ varfont = downgradeCFF2ToCFF(varfont)
1780
+ if inplace:
1781
+ origVarfont.__dict__ = varfont.__dict__.copy()
1782
+
1723
1783
  return varfont
1724
1784
 
1725
1785
 
@@ -1929,7 +1989,7 @@ def main(args=None):
1929
1989
  if limit is None or limit[0] == limit[2]
1930
1990
  }.issuperset(axis.axisTag for axis in varfont["fvar"].axes)
1931
1991
 
1932
- instantiateVariableFont(
1992
+ varfont = instantiateVariableFont(
1933
1993
  varfont,
1934
1994
  axisLimits,
1935
1995
  inplace=True,
fontTools/varLib/iup.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
@@ -2141,7 +2144,7 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
2141
2144
  static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num);
2142
2145
  #define __Pyx_PyNumber_Absolute(x)\
2143
2146
  ((likely(PyLong_CheckExact(x))) ?\
2144
- (likely(__Pyx_PyLong_IsNonNeg(x)) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\
2147
+ (likely(__Pyx_PyLong_IsNonNeg(x)) ? __Pyx_NewRef(x) : __Pyx_PyLong_AbsNeg(x)) :\
2145
2148
  PyNumber_Absolute(x))
2146
2149
  #else
2147
2150
  #define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x)
@@ -14329,7 +14332,7 @@ static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) {
14329
14332
  PyObject *copy = _PyLong_Copy((PyLongObject*)n);
14330
14333
  if (likely(copy)) {
14331
14334
  #if PY_VERSION_HEX >= 0x030C00A7
14332
- ((PyLongObject*)copy)->long_value.lv_tag = ((PyLongObject*)copy)->long_value.lv_tag & ~_PyLong_SIGN_MASK;
14335
+ ((PyLongObject*)copy)->long_value.lv_tag ^= ((PyLongObject*)copy)->long_value.lv_tag & _PyLong_SIGN_MASK;
14333
14336
  #else
14334
14337
  __Pyx_SET_SIZE(copy, -Py_SIZE(copy));
14335
14338
  #endif
@@ -14942,6 +14945,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14942
14945
  changed = 1;
14943
14946
  }
14944
14947
  #endif // CYTHON_METH_FASTCALL
14948
+ #if !CYTHON_COMPILING_IN_PYPY
14945
14949
  else if (strcmp(memb->name, "__module__") == 0) {
14946
14950
  PyObject *descr;
14947
14951
  assert(memb->type == T_OBJECT);
@@ -14956,11 +14960,13 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14956
14960
  }
14957
14961
  changed = 1;
14958
14962
  }
14963
+ #endif // !CYTHON_COMPILING_IN_PYPY
14959
14964
  }
14960
14965
  memb++;
14961
14966
  }
14962
14967
  }
14963
14968
  #endif // !CYTHON_COMPILING_IN_LIMITED_API
14969
+ #if !CYTHON_COMPILING_IN_PYPY
14964
14970
  slot = spec->slots;
14965
14971
  while (slot && slot->slot && slot->slot != Py_tp_getset)
14966
14972
  slot++;
@@ -14992,6 +14998,7 @@ static int __Pyx_fix_up_extension_type_from_spec(PyType_Spec *spec, PyTypeObject
14992
14998
  ++getset;
14993
14999
  }
14994
15000
  }
15001
+ #endif // !CYTHON_COMPILING_IN_PYPY
14995
15002
  if (changed)
14996
15003
  PyType_Modified(type);
14997
15004
  #endif // PY_VERSION_HEX > 0x030900B1
@@ -15090,6 +15097,13 @@ try_unpack:
15090
15097
 
15091
15098
  /* PyObjectCallMethod0 */
15092
15099
  static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
15100
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
15101
+ PyObject *args[1] = {obj};
15102
+ (void) __Pyx_PyObject_GetMethod;
15103
+ (void) __Pyx_PyObject_CallOneArg;
15104
+ (void) __Pyx_PyObject_CallNoArg;
15105
+ return PyObject_VectorcallMethod(method_name, args, 1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
15106
+ #else
15093
15107
  PyObject *method = NULL, *result = NULL;
15094
15108
  int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
15095
15109
  if (likely(is_method)) {
@@ -15102,6 +15116,7 @@ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name
15102
15116
  Py_DECREF(method);
15103
15117
  bad:
15104
15118
  return result;
15119
+ #endif
15105
15120
  }
15106
15121
 
15107
15122
  /* ValidateBasesTuple */
@@ -15489,7 +15504,7 @@ bad:
15489
15504
  }
15490
15505
 
15491
15506
  /* CommonTypesMetaclass */
15492
- PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
15507
+ static PyObject* __pyx_CommonTypesMetaclass_get_module(CYTHON_UNUSED PyObject *self, CYTHON_UNUSED void* context) {
15493
15508
  return PyUnicode_FromString(__PYX_ABI_MODULE_NAME);
15494
15509
  }
15495
15510
  static PyGetSetDef __pyx_CommonTypesMetaclass_getset[] = {
@@ -17939,7 +17954,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyOb
17939
17954
  }
17940
17955
 
17941
17956
  /* PyObjectCallMethod1 */
17942
- #if !(CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000)
17957
+ #if !(CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000)))
17943
17958
  static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
17944
17959
  PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
17945
17960
  Py_DECREF(method);
@@ -17947,7 +17962,7 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
17947
17962
  }
17948
17963
  #endif
17949
17964
  static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
17950
- #if CYTHON_VECTORCALL && __PYX_LIMITED_VERSION_HEX >= 0x030C0000
17965
+ #if CYTHON_VECTORCALL && (__PYX_LIMITED_VERSION_HEX >= 0x030C0000 || (!CYTHON_COMPILING_IN_LIMITED_API && PY_VERSION_HEX >= 0x03090000))
17951
17966
  PyObject *args[2] = {obj, arg};
17952
17967
  (void) __Pyx_PyObject_GetMethod;
17953
17968
  (void) __Pyx_PyObject_CallOneArg;
Binary file
@@ -4,9 +4,16 @@ Instantiate a variation font. Run, eg:
4
4
  .. code-block:: sh
5
5
 
6
6
  $ fonttools varLib.mutator ./NotoSansArabic-VF.ttf wght=140 wdth=85
7
+
8
+ .. warning::
9
+ ``fontTools.varLib.mutator`` is deprecated in favor of :mod:`fontTools.varLib.instancer`
10
+ which provides equivalent full instancing and also supports partial instancing.
11
+ Please migrate CLI usage to ``fonttools varLib.instancer`` and API usage to
12
+ :func:`fontTools.varLib.instancer.instantiateVariableFont`.
7
13
  """
8
14
 
9
15
  from fontTools.misc.fixedTools import floatToFixedToFloat, floatToFixed
16
+ from fontTools.misc.loggingTools import deprecateFunction
10
17
  from fontTools.misc.roundTools import otRound
11
18
  from fontTools.pens.boundsPen import BoundsPen
12
19
  from fontTools.ttLib import TTFont, newTable
@@ -159,6 +166,10 @@ def interpolate_cff2_metrics(varfont, topDict, glyphOrder, loc):
159
166
  hmtx[gname] = tuple(entry)
160
167
 
161
168
 
169
+ @deprecateFunction(
170
+ "use fontTools.varLib.instancer.instantiateVariableFont instead "
171
+ "for either full or partial instancing",
172
+ )
162
173
  def instantiateVariableFont(varfont, location, inplace=False, overlap=True):
163
174
  """Generate a static instance from a variable TTFont and a dictionary
164
175
  defining the desired location along the variable font's axes.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fonttools
3
- Version: 4.59.0
3
+ Version: 4.59.1
4
4
  Summary: Tools to manipulate font files
5
5
  Home-page: http://github.com/fonttools/fonttools
6
6
  Author: Just van Rossum
@@ -168,15 +168,6 @@ are required to unlock the extra features named "ufo", etc.
168
168
 
169
169
  *Extra:* ``lxml``
170
170
 
171
- - ``Lib/fontTools/ufoLib``
172
-
173
- Package for reading and writing UFO source files; it requires:
174
-
175
- * `fs <https://pypi.org/pypi/fs>`__: (aka ``pyfilesystem2``) filesystem
176
- abstraction layer.
177
-
178
- *Extra:* ``ufo``
179
-
180
171
  - ``Lib/fontTools/ttLib/woff2.py``
181
172
 
182
173
  Module to compress/decompress WOFF 2.0 web fonts; it requires:
@@ -269,6 +260,17 @@ are required to unlock the extra features named "ufo", etc.
269
260
 
270
261
  *Extra:* ``pathops``
271
262
 
263
+ - ``Lib/fontTools/ufoLib``
264
+
265
+ Package for reading and writing UFO source files; if available, it will use:
266
+
267
+ * `fs <https://pypi.org/pypi/fs>`__: (aka ``pyfilesystem2``) filesystem abstraction layer
268
+
269
+ for reading and writing UFOs to the local filesystem or zip files (.ufoz), instead of
270
+ the built-in ``fontTools.misc.filesystem`` package.
271
+ The reader and writer classes can in theory also accept any object compatible the
272
+ ``fs.base.FS`` interface, although not all have been tested.
273
+
272
274
  - ``Lib/fontTools/pens/cocoaPen.py`` and ``Lib/fontTools/pens/quartzPen.py``
273
275
 
274
276
  Pens for drawing glyphs with Cocoa ``NSBezierPath`` or ``CGPath`` require:
@@ -386,6 +388,18 @@ Have fun!
386
388
  Changelog
387
389
  ~~~~~~~~~
388
390
 
391
+ 4.59.1 (released 2025-08-14)
392
+ ----------------------------
393
+
394
+ - [featureVars] Update OS/2.usMaxContext if possible after addFeatureVariationsRaw (#3894).
395
+ - [vhmtx] raise TTLibError('not enough data...') when hmtx/vmtx are truncated (#3843, #3901).
396
+ - [feaLib] Combine duplicate features that have the same set of lookups regardless of the order in which those lookups are added to the feature (#3895).
397
+ - [varLib] Deprecate ``varLib.mutator`` in favor of ``varLib.instancer``. The latter
398
+ provides equivalent full (static font) instancing in addition to partial VF instancing.
399
+ CLI users should replace ``fonttools varLib.mutator`` with ``fonttools varLib.instancer``.
400
+ API users should migrate to ``fontTools.varLib.instancer.instantiateVariableFont`` (#2680).
401
+
402
+
389
403
  4.59.0 (released 2025-07-16)
390
404
  ----------------------------
391
405