fonttools 4.56.0__cp313-cp313-win32.whl → 4.58.0__cp313-cp313-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.
- fontTools/__init__.py +1 -1
- fontTools/cffLib/__init__.py +61 -26
- fontTools/config/__init__.py +15 -0
- fontTools/cu2qu/cu2qu.c +15345 -14829
- fontTools/cu2qu/cu2qu.cp313-win32.pyd +0 -0
- fontTools/designspaceLib/statNames.py +14 -7
- fontTools/feaLib/ast.py +92 -13
- fontTools/feaLib/builder.py +52 -13
- fontTools/feaLib/lexer.c +17143 -17986
- fontTools/feaLib/lexer.cp313-win32.pyd +0 -0
- fontTools/feaLib/parser.py +59 -39
- fontTools/fontBuilder.py +6 -0
- fontTools/misc/bezierTools.c +39936 -41831
- fontTools/misc/bezierTools.cp313-win32.pyd +0 -0
- fontTools/misc/etree.py +4 -27
- fontTools/misc/testTools.py +2 -1
- fontTools/mtiLib/__init__.py +0 -2
- fontTools/otlLib/builder.py +195 -145
- fontTools/otlLib/optimize/gpos.py +49 -63
- fontTools/pens/momentsPen.c +13266 -13448
- fontTools/pens/momentsPen.cp313-win32.pyd +0 -0
- fontTools/pens/pointPen.py +21 -12
- fontTools/qu2cu/qu2cu.c +16538 -16269
- fontTools/qu2cu/qu2cu.cp313-win32.pyd +0 -0
- fontTools/subset/__init__.py +11 -0
- fontTools/ttLib/__init__.py +4 -0
- fontTools/ttLib/__main__.py +47 -8
- fontTools/ttLib/tables/D__e_b_g.py +20 -2
- fontTools/ttLib/tables/G_V_A_R_.py +5 -0
- fontTools/ttLib/tables/T_S_I__0.py +14 -3
- fontTools/ttLib/tables/T_S_I__5.py +16 -5
- fontTools/ttLib/tables/__init__.py +1 -0
- fontTools/ttLib/tables/_c_m_a_p.py +19 -6
- fontTools/ttLib/tables/_c_v_t.py +2 -0
- fontTools/ttLib/tables/_f_p_g_m.py +3 -1
- fontTools/ttLib/tables/_g_l_y_f.py +11 -10
- fontTools/ttLib/tables/_g_v_a_r.py +62 -17
- fontTools/ttLib/tables/_p_o_s_t.py +5 -2
- fontTools/ttLib/tables/otBase.py +1 -0
- fontTools/ttLib/tables/otConverters.py +5 -2
- fontTools/ttLib/tables/otTables.py +5 -1
- fontTools/ttLib/ttFont.py +3 -5
- fontTools/ttLib/ttGlyphSet.py +0 -10
- fontTools/ttx.py +13 -1
- fontTools/ufoLib/__init__.py +2 -2
- fontTools/ufoLib/converters.py +89 -25
- fontTools/ufoLib/errors.py +8 -0
- fontTools/ufoLib/etree.py +1 -1
- fontTools/ufoLib/filenames.py +155 -100
- fontTools/ufoLib/glifLib.py +9 -2
- fontTools/ufoLib/kerning.py +66 -36
- fontTools/ufoLib/utils.py +5 -2
- fontTools/unicodedata/Mirrored.py +446 -0
- fontTools/unicodedata/__init__.py +6 -2
- fontTools/varLib/__init__.py +94 -89
- fontTools/varLib/hvar.py +113 -0
- fontTools/varLib/iup.c +19630 -19154
- fontTools/varLib/iup.cp313-win32.pyd +0 -0
- fontTools/varLib/varStore.py +1 -1
- fontTools/voltLib/__main__.py +206 -0
- fontTools/voltLib/ast.py +4 -0
- fontTools/voltLib/parser.py +16 -8
- fontTools/voltLib/voltToFea.py +347 -166
- {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info}/METADATA +60 -12
- {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info}/RECORD +71 -66
- {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info}/WHEEL +1 -1
- fonttools-4.58.0.dist-info/licenses/LICENSE.external +359 -0
- {fonttools-4.56.0.data → fonttools-4.58.0.data}/data/share/man/man1/ttx.1 +0 -0
- {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info}/entry_points.txt +0 -0
- {fonttools-4.56.0.dist-info → fonttools-4.58.0.dist-info/licenses}/LICENSE +0 -0
- {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
|
|
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
|
|
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
|
-
|
|
191
|
-
|
|
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
|
-
@
|
|
201
|
+
@cached_property
|
|
210
202
|
def indices(self):
|
|
211
|
-
|
|
212
|
-
self._indices = bit_indices(self.indices_bitmask)
|
|
213
|
-
return self._indices
|
|
203
|
+
return bit_indices(self.indices_bitmask)
|
|
214
204
|
|
|
215
|
-
@
|
|
205
|
+
@cached_property
|
|
216
206
|
def column_indices(self):
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
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
|
-
@
|
|
217
|
+
@cached_property
|
|
230
218
|
def cost(self):
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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):
|