fonttools 4.59.1__cp310-cp310-win_amd64.whl → 4.60.0__cp310-cp310-win_amd64.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/annotations.py +30 -0
- fontTools/cu2qu/cu2qu.c +1185 -971
- fontTools/cu2qu/cu2qu.cp310-win_amd64.pyd +0 -0
- fontTools/cu2qu/cu2qu.py +36 -4
- fontTools/feaLib/builder.py +9 -3
- fontTools/feaLib/lexer.c +18 -12
- fontTools/feaLib/lexer.cp310-win_amd64.pyd +0 -0
- fontTools/feaLib/parser.py +11 -1
- fontTools/feaLib/variableScalar.py +6 -1
- fontTools/misc/bezierTools.c +18 -12
- fontTools/misc/bezierTools.cp310-win_amd64.pyd +0 -0
- fontTools/misc/enumTools.py +23 -0
- fontTools/misc/textTools.py +4 -2
- fontTools/pens/filterPen.py +218 -26
- fontTools/pens/momentsPen.c +18 -12
- fontTools/pens/momentsPen.cp310-win_amd64.pyd +0 -0
- fontTools/pens/pointPen.py +40 -6
- fontTools/qu2cu/qu2cu.c +30 -16
- fontTools/qu2cu/qu2cu.cp310-win_amd64.pyd +0 -0
- fontTools/subset/__init__.py +1 -0
- fontTools/ttLib/tables/_a_v_a_r.py +4 -2
- fontTools/ttLib/tables/_n_a_m_e.py +11 -6
- fontTools/ttLib/tables/_p_o_s_t.py +5 -5
- fontTools/ufoLib/__init__.py +279 -176
- fontTools/ufoLib/converters.py +14 -5
- fontTools/ufoLib/filenames.py +16 -6
- fontTools/ufoLib/glifLib.py +286 -190
- fontTools/ufoLib/kerning.py +32 -12
- fontTools/ufoLib/utils.py +41 -13
- fontTools/ufoLib/validators.py +121 -97
- fontTools/varLib/__init__.py +80 -1
- fontTools/varLib/avar/__init__.py +0 -0
- fontTools/varLib/avar/__main__.py +72 -0
- fontTools/varLib/avar/build.py +79 -0
- fontTools/varLib/avar/map.py +108 -0
- fontTools/varLib/avar/plan.py +1004 -0
- fontTools/varLib/{avar.py → avar/unbuild.py} +70 -59
- fontTools/varLib/avarPlanner.py +3 -999
- fontTools/varLib/instancer/__init__.py +56 -18
- fontTools/varLib/interpolatableHelpers.py +3 -0
- fontTools/varLib/iup.c +24 -14
- fontTools/varLib/iup.cp310-win_amd64.pyd +0 -0
- {fonttools-4.59.1.dist-info → fonttools-4.60.0.dist-info}/METADATA +43 -2
- {fonttools-4.59.1.dist-info → fonttools-4.60.0.dist-info}/RECORD +51 -44
- {fonttools-4.59.1.data → fonttools-4.60.0.data}/data/share/man/man1/ttx.1 +0 -0
- {fonttools-4.59.1.dist-info → fonttools-4.60.0.dist-info}/WHEEL +0 -0
- {fonttools-4.59.1.dist-info → fonttools-4.60.0.dist-info}/entry_points.txt +0 -0
- {fonttools-4.59.1.dist-info → fonttools-4.60.0.dist-info}/licenses/LICENSE +0 -0
- {fonttools-4.59.1.dist-info → fonttools-4.60.0.dist-info}/licenses/LICENSE.external +0 -0
- {fonttools-4.59.1.dist-info → fonttools-4.60.0.dist-info}/top_level.txt +0 -0
fontTools/ufoLib/converters.py
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Mapping, Any
|
|
4
|
+
from collections.abc import Container
|
|
5
|
+
|
|
6
|
+
from fontTools.annotations import KerningNested
|
|
7
|
+
|
|
1
8
|
"""
|
|
2
9
|
Functions for converting UFO1 or UFO2 files into UFO3 format.
|
|
3
10
|
|
|
@@ -9,7 +16,9 @@ or UFO2, and _to_ UFO3.
|
|
|
9
16
|
# adapted from the UFO spec
|
|
10
17
|
|
|
11
18
|
|
|
12
|
-
def convertUFO1OrUFO2KerningToUFO3Kerning(
|
|
19
|
+
def convertUFO1OrUFO2KerningToUFO3Kerning(
|
|
20
|
+
kerning: KerningNested, groups: dict[str, list[str]], glyphSet: Container[str] = ()
|
|
21
|
+
) -> tuple[KerningNested, dict[str, list[str]], dict[str, dict[str, str]]]:
|
|
13
22
|
"""Convert kerning data in UFO1 or UFO2 syntax into UFO3 syntax.
|
|
14
23
|
|
|
15
24
|
Args:
|
|
@@ -40,7 +49,7 @@ def convertUFO1OrUFO2KerningToUFO3Kerning(kerning, groups, glyphSet=()):
|
|
|
40
49
|
if not second.startswith("public.kern2."):
|
|
41
50
|
secondReferencedGroups.add(second)
|
|
42
51
|
# Create new names for these groups.
|
|
43
|
-
firstRenamedGroups = {}
|
|
52
|
+
firstRenamedGroups: dict[str, str] = {}
|
|
44
53
|
for first in firstReferencedGroups:
|
|
45
54
|
# Make a list of existing group names.
|
|
46
55
|
existingGroupNames = list(groups.keys()) + list(firstRenamedGroups.keys())
|
|
@@ -52,7 +61,7 @@ def convertUFO1OrUFO2KerningToUFO3Kerning(kerning, groups, glyphSet=()):
|
|
|
52
61
|
newName = makeUniqueGroupName(newName, existingGroupNames)
|
|
53
62
|
# Store for use later.
|
|
54
63
|
firstRenamedGroups[first] = newName
|
|
55
|
-
secondRenamedGroups = {}
|
|
64
|
+
secondRenamedGroups: dict[str, str] = {}
|
|
56
65
|
for second in secondReferencedGroups:
|
|
57
66
|
# Make a list of existing group names.
|
|
58
67
|
existingGroupNames = list(groups.keys()) + list(secondRenamedGroups.keys())
|
|
@@ -84,7 +93,7 @@ def convertUFO1OrUFO2KerningToUFO3Kerning(kerning, groups, glyphSet=()):
|
|
|
84
93
|
return newKerning, groups, dict(side1=firstRenamedGroups, side2=secondRenamedGroups)
|
|
85
94
|
|
|
86
95
|
|
|
87
|
-
def findKnownKerningGroups(groups):
|
|
96
|
+
def findKnownKerningGroups(groups: Mapping[str, Any]) -> tuple[set[str], set[str]]:
|
|
88
97
|
"""Find all kerning groups in a UFO1 or UFO2 font that use known prefixes.
|
|
89
98
|
|
|
90
99
|
In some cases, not all kerning groups will be referenced
|
|
@@ -150,7 +159,7 @@ def findKnownKerningGroups(groups):
|
|
|
150
159
|
return firstGroups, secondGroups
|
|
151
160
|
|
|
152
161
|
|
|
153
|
-
def makeUniqueGroupName(name, groupNames, counter=0):
|
|
162
|
+
def makeUniqueGroupName(name: str, groupNames: list[str], counter: int = 0) -> str:
|
|
154
163
|
"""Make a kerning group name that will be unique within the set of group names.
|
|
155
164
|
|
|
156
165
|
If the requested kerning group name already exists within the set, this
|
fontTools/ufoLib/filenames.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Iterable
|
|
4
|
+
|
|
1
5
|
"""
|
|
2
6
|
Convert user-provided internal UFO names to spec-compliant filenames.
|
|
3
7
|
|
|
@@ -27,7 +31,7 @@ by Tal Leming and is copyright (c) 2005-2016, The RoboFab Developers:
|
|
|
27
31
|
# inclusive.
|
|
28
32
|
# 3. Various characters that (mostly) Windows and POSIX-y filesystems don't
|
|
29
33
|
# allow, plus "(" and ")", as per the specification.
|
|
30
|
-
illegalCharacters = {
|
|
34
|
+
illegalCharacters: set[str] = {
|
|
31
35
|
"\x00",
|
|
32
36
|
"\x01",
|
|
33
37
|
"\x02",
|
|
@@ -76,7 +80,7 @@ illegalCharacters = {
|
|
|
76
80
|
"|",
|
|
77
81
|
"\x7f",
|
|
78
82
|
}
|
|
79
|
-
reservedFileNames = {
|
|
83
|
+
reservedFileNames: set[str] = {
|
|
80
84
|
"aux",
|
|
81
85
|
"clock$",
|
|
82
86
|
"com1",
|
|
@@ -101,14 +105,16 @@ reservedFileNames = {
|
|
|
101
105
|
"nul",
|
|
102
106
|
"prn",
|
|
103
107
|
}
|
|
104
|
-
maxFileNameLength = 255
|
|
108
|
+
maxFileNameLength: int = 255
|
|
105
109
|
|
|
106
110
|
|
|
107
111
|
class NameTranslationError(Exception):
|
|
108
112
|
pass
|
|
109
113
|
|
|
110
114
|
|
|
111
|
-
def userNameToFileName(
|
|
115
|
+
def userNameToFileName(
|
|
116
|
+
userName: str, existing: Iterable[str] = (), prefix: str = "", suffix: str = ""
|
|
117
|
+
) -> str:
|
|
112
118
|
"""Converts from a user name to a file name.
|
|
113
119
|
|
|
114
120
|
Takes care to avoid illegal characters, reserved file names, ambiguity between
|
|
@@ -212,7 +218,9 @@ def userNameToFileName(userName: str, existing=(), prefix="", suffix=""):
|
|
|
212
218
|
return fullName
|
|
213
219
|
|
|
214
220
|
|
|
215
|
-
def handleClash1(
|
|
221
|
+
def handleClash1(
|
|
222
|
+
userName: str, existing: Iterable[str] = [], prefix: str = "", suffix: str = ""
|
|
223
|
+
) -> str:
|
|
216
224
|
"""A helper function that resolves collisions with existing names when choosing a filename.
|
|
217
225
|
|
|
218
226
|
This function attempts to append an unused integer counter to the filename.
|
|
@@ -278,7 +286,9 @@ def handleClash1(userName, existing=[], prefix="", suffix=""):
|
|
|
278
286
|
return finalName
|
|
279
287
|
|
|
280
288
|
|
|
281
|
-
def handleClash2(
|
|
289
|
+
def handleClash2(
|
|
290
|
+
existing: Iterable[str] = [], prefix: str = "", suffix: str = ""
|
|
291
|
+
) -> str:
|
|
282
292
|
"""A helper function that resolves collisions with existing names when choosing a filename.
|
|
283
293
|
|
|
284
294
|
This function is a fallback to :func:`handleClash1`. It attempts to append an unused integer counter to the filename.
|