fonttools 4.57.0__cp310-cp310-win32.whl → 4.58.1__cp310-cp310-win32.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/__init__.py +61 -26
  3. fontTools/cffLib/specializer.py +4 -1
  4. fontTools/cu2qu/cu2qu.c +15357 -14829
  5. fontTools/cu2qu/cu2qu.cp310-win32.pyd +0 -0
  6. fontTools/designspaceLib/statNames.py +14 -7
  7. fontTools/feaLib/ast.py +12 -9
  8. fontTools/feaLib/builder.py +75 -49
  9. fontTools/feaLib/lexer.c +17160 -17986
  10. fontTools/feaLib/lexer.cp310-win32.pyd +0 -0
  11. fontTools/feaLib/parser.py +1 -39
  12. fontTools/fontBuilder.py +6 -0
  13. fontTools/merge/cmap.py +33 -1
  14. fontTools/merge/tables.py +12 -1
  15. fontTools/misc/bezierTools.c +39948 -41831
  16. fontTools/misc/bezierTools.cp310-win32.pyd +0 -0
  17. fontTools/misc/etree.py +4 -27
  18. fontTools/misc/loggingTools.py +1 -1
  19. fontTools/misc/symfont.py +6 -8
  20. fontTools/mtiLib/__init__.py +1 -3
  21. fontTools/otlLib/builder.py +359 -145
  22. fontTools/otlLib/optimize/gpos.py +42 -62
  23. fontTools/pens/momentsPen.c +13283 -13448
  24. fontTools/pens/momentsPen.cp310-win32.pyd +0 -0
  25. fontTools/pens/pointPen.py +21 -12
  26. fontTools/pens/t2CharStringPen.py +31 -11
  27. fontTools/qu2cu/qu2cu.c +16550 -16269
  28. fontTools/qu2cu/qu2cu.cp310-win32.pyd +0 -0
  29. fontTools/subset/__init__.py +12 -1
  30. fontTools/ttLib/tables/G_V_A_R_.py +5 -0
  31. fontTools/ttLib/tables/T_S_I__0.py +14 -3
  32. fontTools/ttLib/tables/T_S_I__5.py +16 -5
  33. fontTools/ttLib/tables/__init__.py +1 -0
  34. fontTools/ttLib/tables/_c_v_t.py +2 -0
  35. fontTools/ttLib/tables/_f_p_g_m.py +3 -1
  36. fontTools/ttLib/tables/_g_l_y_f.py +2 -6
  37. fontTools/ttLib/tables/_g_v_a_r.py +58 -15
  38. fontTools/ttLib/tables/_p_o_s_t.py +5 -2
  39. fontTools/ttLib/tables/otBase.py +1 -0
  40. fontTools/ufoLib/__init__.py +3 -3
  41. fontTools/ufoLib/converters.py +89 -25
  42. fontTools/ufoLib/errors.py +8 -0
  43. fontTools/ufoLib/etree.py +1 -1
  44. fontTools/ufoLib/filenames.py +155 -100
  45. fontTools/ufoLib/glifLib.py +9 -2
  46. fontTools/ufoLib/kerning.py +66 -36
  47. fontTools/ufoLib/utils.py +5 -2
  48. fontTools/unicodedata/Mirrored.py +446 -0
  49. fontTools/unicodedata/__init__.py +6 -2
  50. fontTools/varLib/__init__.py +20 -6
  51. fontTools/varLib/featureVars.py +13 -7
  52. fontTools/varLib/hvar.py +1 -1
  53. fontTools/varLib/instancer/__init__.py +14 -5
  54. fontTools/varLib/iup.c +19642 -19154
  55. fontTools/varLib/iup.cp310-win32.pyd +0 -0
  56. fontTools/voltLib/__main__.py +206 -0
  57. fontTools/voltLib/ast.py +4 -0
  58. fontTools/voltLib/parser.py +16 -8
  59. fontTools/voltLib/voltToFea.py +347 -166
  60. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/METADATA +64 -11
  61. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/RECORD +67 -63
  62. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/WHEEL +1 -1
  63. fonttools-4.58.1.dist-info/licenses/LICENSE.external +359 -0
  64. {fonttools-4.57.0.data → fonttools-4.58.1.data}/data/share/man/man1/ttx.1 +0 -0
  65. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/entry_points.txt +0 -0
  66. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/licenses/LICENSE +0 -0
  67. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,8 @@
1
1
  import logging
2
2
  import os
3
3
  from collections import defaultdict, namedtuple
4
- from functools import reduce
4
+ from dataclasses import dataclass
5
+ from functools import cached_property, reduce
5
6
  from itertools import chain
6
7
  from math import log2
7
8
  from typing import DefaultDict, Dict, Iterable, List, Sequence, Tuple
@@ -192,79 +193,58 @@ ClusteringContext = namedtuple(
192
193
  )
193
194
 
194
195
 
196
+ @dataclass
195
197
  class Cluster:
196
- # TODO(Python 3.7): Turn this into a dataclass
197
- # ctx: ClusteringContext
198
- # indices: int
199
- # Caches
200
- # TODO(Python 3.8): use functools.cached_property instead of the
201
- # manually cached properties, and remove the cache fields listed below.
202
- # _indices: Optional[List[int]] = None
203
- # _column_indices: Optional[List[int]] = None
204
- # _cost: Optional[int] = None
205
-
206
- __slots__ = "ctx", "indices_bitmask", "_indices", "_column_indices", "_cost"
207
-
208
- def __init__(self, ctx: ClusteringContext, indices_bitmask: int):
209
- self.ctx = ctx
210
- self.indices_bitmask = indices_bitmask
211
- self._indices = None
212
- self._column_indices = None
213
- self._cost = None
198
+ ctx: ClusteringContext
199
+ indices_bitmask: int
214
200
 
215
- @property
201
+ @cached_property
216
202
  def indices(self):
217
- if self._indices is None:
218
- self._indices = bit_indices(self.indices_bitmask)
219
- return self._indices
203
+ return bit_indices(self.indices_bitmask)
220
204
 
221
- @property
205
+ @cached_property
222
206
  def column_indices(self):
223
- if self._column_indices is None:
224
- # Indices of columns that have a 1 in at least 1 line
225
- # => binary OR all the lines
226
- bitmask = reduce(int.__or__, (self.ctx.lines[i] for i in self.indices))
227
- self._column_indices = bit_indices(bitmask)
228
- return self._column_indices
207
+ # Indices of columns that have a 1 in at least 1 line
208
+ # => binary OR all the lines
209
+ bitmask = reduce(int.__or__, (self.ctx.lines[i] for i in self.indices))
210
+ return bit_indices(bitmask)
229
211
 
230
212
  @property
231
213
  def width(self):
232
214
  # Add 1 because Class2=0 cannot be used but needs to be encoded.
233
215
  return len(self.column_indices) + 1
234
216
 
235
- @property
217
+ @cached_property
236
218
  def cost(self):
237
- if self._cost is None:
238
- self._cost = (
239
- # 2 bytes to store the offset to this subtable in the Lookup table above
240
- 2
241
- # Contents of the subtable
242
- # From: https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#pair-adjustment-positioning-format-2-class-pair-adjustment
243
- # uint16 posFormat Format identifier: format = 2
244
- + 2
245
- # Offset16 coverageOffset Offset to Coverage table, from beginning of PairPos subtable.
246
- + 2
247
- + self.coverage_bytes
248
- # uint16 valueFormat1 ValueRecord definition — for the first glyph of the pair (may be zero).
249
- + 2
250
- # uint16 valueFormat2 ValueRecord definition — for the second glyph of the pair (may be zero).
251
- + 2
252
- # Offset16 classDef1Offset Offset to ClassDef table, from beginning of PairPos subtable — for the first glyph of the pair.
253
- + 2
254
- + self.classDef1_bytes
255
- # Offset16 classDef2Offset Offset to ClassDef table, from beginning of PairPos subtable — for the second glyph of the pair.
256
- + 2
257
- + self.classDef2_bytes
258
- # uint16 class1Count Number of classes in classDef1 table — includes Class 0.
259
- + 2
260
- # uint16 class2Count Number of classes in classDef2 table — includes Class 0.
261
- + 2
262
- # Class1Record class1Records[class1Count] Array of Class1 records, ordered by classes in classDef1.
263
- + (self.ctx.valueFormat1_bytes + self.ctx.valueFormat2_bytes)
264
- * len(self.indices)
265
- * self.width
266
- )
267
- return self._cost
219
+ return (
220
+ # 2 bytes to store the offset to this subtable in the Lookup table above
221
+ 2
222
+ # Contents of the subtable
223
+ # From: https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#pair-adjustment-positioning-format-2-class-pair-adjustment
224
+ # uint16 posFormat Format identifier: format = 2
225
+ + 2
226
+ # Offset16 coverageOffset Offset to Coverage table, from beginning of PairPos subtable.
227
+ + 2
228
+ + self.coverage_bytes
229
+ # uint16 valueFormat1 ValueRecord definition — for the first glyph of the pair (may be zero).
230
+ + 2
231
+ # uint16 valueFormat2 ValueRecord definition — for the second glyph of the pair (may be zero).
232
+ + 2
233
+ # Offset16 classDef1Offset Offset to ClassDef table, from beginning of PairPos subtable — for the first glyph of the pair.
234
+ + 2
235
+ + self.classDef1_bytes
236
+ # Offset16 classDef2Offset Offset to ClassDef table, from beginning of PairPos subtable — for the second glyph of the pair.
237
+ + 2
238
+ + self.classDef2_bytes
239
+ # uint16 class1Count Number of classes in classDef1 table — includes Class 0.
240
+ + 2
241
+ # uint16 class2Count Number of classes in classDef2 table — includes Class 0.
242
+ + 2
243
+ # Class1Record class1Records[class1Count] Array of Class1 records, ordered by classes in classDef1.
244
+ + (self.ctx.valueFormat1_bytes + self.ctx.valueFormat2_bytes)
245
+ * len(self.indices)
246
+ * self.width
247
+ )
268
248
 
269
249
  @property
270
250
  def coverage_bytes(self):