fonttools 4.56.0__cp39-cp39-musllinux_1_2_aarch64.whl → 4.58.0__cp39-cp39-musllinux_1_2_aarch64.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 (71) hide show
  1. fontTools/__init__.py +1 -1
  2. fontTools/cffLib/__init__.py +61 -26
  3. fontTools/config/__init__.py +15 -0
  4. fontTools/cu2qu/cu2qu.c +4563 -4047
  5. fontTools/cu2qu/cu2qu.cpython-39-aarch64-linux-gnu.so +0 -0
  6. fontTools/designspaceLib/statNames.py +14 -7
  7. fontTools/feaLib/ast.py +92 -13
  8. fontTools/feaLib/builder.py +52 -13
  9. fontTools/feaLib/lexer.c +6268 -7111
  10. fontTools/feaLib/lexer.cpython-39-aarch64-linux-gnu.so +0 -0
  11. fontTools/feaLib/parser.py +59 -39
  12. fontTools/fontBuilder.py +6 -0
  13. fontTools/misc/bezierTools.c +13479 -15374
  14. fontTools/misc/bezierTools.cpython-39-aarch64-linux-gnu.so +0 -0
  15. fontTools/misc/etree.py +4 -27
  16. fontTools/misc/testTools.py +2 -1
  17. fontTools/mtiLib/__init__.py +0 -2
  18. fontTools/otlLib/builder.py +195 -145
  19. fontTools/otlLib/optimize/gpos.py +49 -63
  20. fontTools/pens/momentsPen.c +4492 -4674
  21. fontTools/pens/momentsPen.cpython-39-aarch64-linux-gnu.so +0 -0
  22. fontTools/pens/pointPen.py +21 -12
  23. fontTools/qu2cu/qu2cu.c +5727 -5458
  24. fontTools/qu2cu/qu2cu.cpython-39-aarch64-linux-gnu.so +0 -0
  25. fontTools/subset/__init__.py +11 -0
  26. fontTools/ttLib/__init__.py +4 -0
  27. fontTools/ttLib/__main__.py +47 -8
  28. fontTools/ttLib/tables/D__e_b_g.py +20 -2
  29. fontTools/ttLib/tables/G_V_A_R_.py +5 -0
  30. fontTools/ttLib/tables/T_S_I__0.py +14 -3
  31. fontTools/ttLib/tables/T_S_I__5.py +16 -5
  32. fontTools/ttLib/tables/__init__.py +1 -0
  33. fontTools/ttLib/tables/_c_m_a_p.py +19 -6
  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 +11 -10
  37. fontTools/ttLib/tables/_g_v_a_r.py +62 -17
  38. fontTools/ttLib/tables/_p_o_s_t.py +5 -2
  39. fontTools/ttLib/tables/otBase.py +1 -0
  40. fontTools/ttLib/tables/otConverters.py +5 -2
  41. fontTools/ttLib/tables/otTables.py +5 -1
  42. fontTools/ttLib/ttFont.py +3 -5
  43. fontTools/ttLib/ttGlyphSet.py +0 -10
  44. fontTools/ttx.py +13 -1
  45. fontTools/ufoLib/__init__.py +2 -2
  46. fontTools/ufoLib/converters.py +89 -25
  47. fontTools/ufoLib/errors.py +8 -0
  48. fontTools/ufoLib/etree.py +1 -1
  49. fontTools/ufoLib/filenames.py +155 -100
  50. fontTools/ufoLib/glifLib.py +9 -2
  51. fontTools/ufoLib/kerning.py +66 -36
  52. fontTools/ufoLib/utils.py +5 -2
  53. fontTools/unicodedata/Mirrored.py +446 -0
  54. fontTools/unicodedata/__init__.py +6 -2
  55. fontTools/varLib/__init__.py +94 -89
  56. fontTools/varLib/hvar.py +113 -0
  57. fontTools/varLib/iup.c +6700 -6224
  58. fontTools/varLib/iup.cpython-39-aarch64-linux-gnu.so +0 -0
  59. fontTools/varLib/varStore.py +1 -1
  60. fontTools/voltLib/__main__.py +206 -0
  61. fontTools/voltLib/ast.py +4 -0
  62. fontTools/voltLib/parser.py +16 -8
  63. fontTools/voltLib/voltToFea.py +347 -166
  64. {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info}/METADATA +60 -12
  65. {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info}/RECORD +277 -272
  66. {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info}/WHEEL +1 -1
  67. fonttools-4.58.0.dist-info/licenses/LICENSE.external +359 -0
  68. {fonttools-4.56.0.data → fonttools-4.58.0.data}/data/share/man/man1/ttx.1 +0 -0
  69. {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info}/entry_points.txt +0 -0
  70. {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info/licenses}/LICENSE +0 -0
  71. {fonttools-4.56.0.dist-info → fonttools-4.58.0.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
@@ -53,12 +54,18 @@ def compact(font: TTFont, level: int) -> TTFont:
53
54
  # are not grouped together first; instead each subtable is treated
54
55
  # independently, so currently this step is:
55
56
  # Split existing subtables into more smaller subtables
56
- gpos = font["GPOS"]
57
+ gpos = font.get("GPOS")
58
+
59
+ # If the font does not contain a GPOS table, there is nothing to do.
60
+ if gpos is None:
61
+ return font
62
+
57
63
  for lookup in gpos.table.LookupList.Lookup:
58
64
  if lookup.LookupType == 2:
59
65
  compact_lookup(font, level, lookup)
60
66
  elif lookup.LookupType == 9 and lookup.SubTable[0].ExtensionLookupType == 2:
61
67
  compact_ext_lookup(font, level, lookup)
68
+
62
69
  return font
63
70
 
64
71
 
@@ -186,79 +193,58 @@ ClusteringContext = namedtuple(
186
193
  )
187
194
 
188
195
 
196
+ @dataclass
189
197
  class Cluster:
190
- # TODO(Python 3.7): Turn this into a dataclass
191
- # ctx: ClusteringContext
192
- # indices: int
193
- # Caches
194
- # TODO(Python 3.8): use functools.cached_property instead of the
195
- # manually cached properties, and remove the cache fields listed below.
196
- # _indices: Optional[List[int]] = None
197
- # _column_indices: Optional[List[int]] = None
198
- # _cost: Optional[int] = None
199
-
200
- __slots__ = "ctx", "indices_bitmask", "_indices", "_column_indices", "_cost"
201
-
202
- def __init__(self, ctx: ClusteringContext, indices_bitmask: int):
203
- self.ctx = ctx
204
- self.indices_bitmask = indices_bitmask
205
- self._indices = None
206
- self._column_indices = None
207
- self._cost = None
198
+ ctx: ClusteringContext
199
+ indices_bitmask: int
208
200
 
209
- @property
201
+ @cached_property
210
202
  def indices(self):
211
- if self._indices is None:
212
- self._indices = bit_indices(self.indices_bitmask)
213
- return self._indices
203
+ return bit_indices(self.indices_bitmask)
214
204
 
215
- @property
205
+ @cached_property
216
206
  def column_indices(self):
217
- if self._column_indices is None:
218
- # Indices of columns that have a 1 in at least 1 line
219
- # => binary OR all the lines
220
- bitmask = reduce(int.__or__, (self.ctx.lines[i] for i in self.indices))
221
- self._column_indices = bit_indices(bitmask)
222
- 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)
223
211
 
224
212
  @property
225
213
  def width(self):
226
214
  # Add 1 because Class2=0 cannot be used but needs to be encoded.
227
215
  return len(self.column_indices) + 1
228
216
 
229
- @property
217
+ @cached_property
230
218
  def cost(self):
231
- if self._cost is None:
232
- self._cost = (
233
- # 2 bytes to store the offset to this subtable in the Lookup table above
234
- 2
235
- # Contents of the subtable
236
- # From: https://docs.microsoft.com/en-us/typography/opentype/spec/gpos#pair-adjustment-positioning-format-2-class-pair-adjustment
237
- # uint16 posFormat Format identifier: format = 2
238
- + 2
239
- # Offset16 coverageOffset Offset to Coverage table, from beginning of PairPos subtable.
240
- + 2
241
- + self.coverage_bytes
242
- # uint16 valueFormat1 ValueRecord definition — for the first glyph of the pair (may be zero).
243
- + 2
244
- # uint16 valueFormat2 ValueRecord definition — for the second glyph of the pair (may be zero).
245
- + 2
246
- # Offset16 classDef1Offset Offset to ClassDef table, from beginning of PairPos subtable — for the first glyph of the pair.
247
- + 2
248
- + self.classDef1_bytes
249
- # Offset16 classDef2Offset Offset to ClassDef table, from beginning of PairPos subtable — for the second glyph of the pair.
250
- + 2
251
- + self.classDef2_bytes
252
- # uint16 class1Count Number of classes in classDef1 table — includes Class 0.
253
- + 2
254
- # uint16 class2Count Number of classes in classDef2 table — includes Class 0.
255
- + 2
256
- # Class1Record class1Records[class1Count] Array of Class1 records, ordered by classes in classDef1.
257
- + (self.ctx.valueFormat1_bytes + self.ctx.valueFormat2_bytes)
258
- * len(self.indices)
259
- * self.width
260
- )
261
- 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
+ )
262
248
 
263
249
  @property
264
250
  def coverage_bytes(self):