fonttools 4.57.0__cp310-cp310-macosx_10_9_universal2.whl → 4.58.1__cp310-cp310-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.
- fontTools/__init__.py +1 -1
- fontTools/cffLib/__init__.py +61 -26
- fontTools/cffLib/specializer.py +4 -1
- fontTools/cu2qu/cu2qu.c +4578 -4050
- fontTools/cu2qu/cu2qu.cpython-310-darwin.so +0 -0
- fontTools/designspaceLib/statNames.py +14 -7
- fontTools/feaLib/ast.py +12 -9
- fontTools/feaLib/builder.py +75 -49
- fontTools/feaLib/lexer.c +6290 -7116
- fontTools/feaLib/lexer.cpython-310-darwin.so +0 -0
- fontTools/feaLib/parser.py +1 -39
- fontTools/fontBuilder.py +6 -0
- fontTools/merge/cmap.py +33 -1
- fontTools/merge/tables.py +12 -1
- fontTools/misc/bezierTools.c +13668 -15551
- fontTools/misc/bezierTools.cpython-310-darwin.so +0 -0
- fontTools/misc/etree.py +4 -27
- fontTools/misc/loggingTools.py +1 -1
- fontTools/misc/symfont.py +6 -8
- fontTools/mtiLib/__init__.py +1 -3
- fontTools/otlLib/builder.py +359 -145
- fontTools/otlLib/optimize/gpos.py +42 -62
- fontTools/pens/momentsPen.c +4509 -4674
- fontTools/pens/momentsPen.cpython-310-darwin.so +0 -0
- fontTools/pens/pointPen.py +21 -12
- fontTools/pens/t2CharStringPen.py +31 -11
- fontTools/qu2cu/qu2cu.c +5746 -5465
- fontTools/qu2cu/qu2cu.cpython-310-darwin.so +0 -0
- fontTools/subset/__init__.py +12 -1
- 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_v_t.py +2 -0
- fontTools/ttLib/tables/_f_p_g_m.py +3 -1
- fontTools/ttLib/tables/_g_l_y_f.py +2 -6
- fontTools/ttLib/tables/_g_v_a_r.py +58 -15
- fontTools/ttLib/tables/_p_o_s_t.py +5 -2
- fontTools/ttLib/tables/otBase.py +1 -0
- fontTools/ufoLib/__init__.py +3 -3
- 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 +20 -6
- fontTools/varLib/featureVars.py +13 -7
- fontTools/varLib/hvar.py +1 -1
- fontTools/varLib/instancer/__init__.py +14 -5
- fontTools/varLib/iup.c +6851 -6363
- fontTools/varLib/iup.cpython-310-darwin.so +0 -0
- 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.57.0.dist-info → fonttools-4.58.1.dist-info}/METADATA +64 -11
- {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/RECORD +67 -63
- {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/WHEEL +1 -1
- fonttools-4.58.1.dist-info/licenses/LICENSE.external +359 -0
- {fonttools-4.57.0.data → fonttools-4.58.1.data}/data/share/man/man1/ttx.1 +0 -0
- {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/entry_points.txt +0 -0
- {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/licenses/LICENSE +0 -0
- {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/top_level.txt +0 -0
|
Binary file
|
fontTools/pens/pointPen.py
CHANGED
|
@@ -12,12 +12,14 @@ This allows the caller to provide more data for each point.
|
|
|
12
12
|
For instance, whether or not a point is smooth, and its name.
|
|
13
13
|
"""
|
|
14
14
|
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
15
17
|
import math
|
|
16
|
-
from typing import Any, Optional, Tuple
|
|
18
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
17
19
|
|
|
18
20
|
from fontTools.misc.loggingTools import LogMixin
|
|
19
|
-
from fontTools.pens.basePen import AbstractPen, MissingComponentError, PenError
|
|
20
21
|
from fontTools.misc.transform import DecomposedTransform, Identity
|
|
22
|
+
from fontTools.pens.basePen import AbstractPen, MissingComponentError, PenError
|
|
21
23
|
|
|
22
24
|
__all__ = [
|
|
23
25
|
"AbstractPointPen",
|
|
@@ -28,6 +30,14 @@ __all__ = [
|
|
|
28
30
|
"ReverseContourPointPen",
|
|
29
31
|
]
|
|
30
32
|
|
|
33
|
+
# Some type aliases to make it easier below
|
|
34
|
+
Point = Tuple[float, float]
|
|
35
|
+
PointName = Optional[str]
|
|
36
|
+
# [(pt, smooth, name, kwargs)]
|
|
37
|
+
SegmentPointList = List[Tuple[Optional[Point], bool, PointName, Any]]
|
|
38
|
+
SegmentType = Optional[str]
|
|
39
|
+
SegmentList = List[Tuple[SegmentType, SegmentPointList]]
|
|
40
|
+
|
|
31
41
|
|
|
32
42
|
class AbstractPointPen:
|
|
33
43
|
"""Baseclass for all PointPens."""
|
|
@@ -88,7 +98,7 @@ class BasePointToSegmentPen(AbstractPointPen):
|
|
|
88
98
|
care of all the edge cases.
|
|
89
99
|
"""
|
|
90
100
|
|
|
91
|
-
def __init__(self):
|
|
101
|
+
def __init__(self) -> None:
|
|
92
102
|
self.currentPath = None
|
|
93
103
|
|
|
94
104
|
def beginPath(self, identifier=None, **kwargs):
|
|
@@ -96,7 +106,7 @@ class BasePointToSegmentPen(AbstractPointPen):
|
|
|
96
106
|
raise PenError("Path already begun.")
|
|
97
107
|
self.currentPath = []
|
|
98
108
|
|
|
99
|
-
def _flushContour(self, segments):
|
|
109
|
+
def _flushContour(self, segments: SegmentList) -> None:
|
|
100
110
|
"""Override this method.
|
|
101
111
|
|
|
102
112
|
It will be called for each non-empty sub path with a list
|
|
@@ -124,7 +134,7 @@ class BasePointToSegmentPen(AbstractPointPen):
|
|
|
124
134
|
"""
|
|
125
135
|
raise NotImplementedError
|
|
126
136
|
|
|
127
|
-
def endPath(self):
|
|
137
|
+
def endPath(self) -> None:
|
|
128
138
|
if self.currentPath is None:
|
|
129
139
|
raise PenError("Path not begun.")
|
|
130
140
|
points = self.currentPath
|
|
@@ -134,7 +144,7 @@ class BasePointToSegmentPen(AbstractPointPen):
|
|
|
134
144
|
if len(points) == 1:
|
|
135
145
|
# Not much more we can do than output a single move segment.
|
|
136
146
|
pt, segmentType, smooth, name, kwargs = points[0]
|
|
137
|
-
segments = [("move", [(pt, smooth, name, kwargs)])]
|
|
147
|
+
segments: SegmentList = [("move", [(pt, smooth, name, kwargs)])]
|
|
138
148
|
self._flushContour(segments)
|
|
139
149
|
return
|
|
140
150
|
segments = []
|
|
@@ -162,7 +172,7 @@ class BasePointToSegmentPen(AbstractPointPen):
|
|
|
162
172
|
else:
|
|
163
173
|
points = points[firstOnCurve + 1 :] + points[: firstOnCurve + 1]
|
|
164
174
|
|
|
165
|
-
currentSegment = []
|
|
175
|
+
currentSegment: SegmentPointList = []
|
|
166
176
|
for pt, segmentType, smooth, name, kwargs in points:
|
|
167
177
|
currentSegment.append((pt, smooth, name, kwargs))
|
|
168
178
|
if segmentType is None:
|
|
@@ -189,7 +199,7 @@ class PointToSegmentPen(BasePointToSegmentPen):
|
|
|
189
199
|
and kwargs.
|
|
190
200
|
"""
|
|
191
201
|
|
|
192
|
-
def __init__(self, segmentPen, outputImpliedClosingLine=False):
|
|
202
|
+
def __init__(self, segmentPen, outputImpliedClosingLine: bool = False) -> None:
|
|
193
203
|
BasePointToSegmentPen.__init__(self)
|
|
194
204
|
self.pen = segmentPen
|
|
195
205
|
self.outputImpliedClosingLine = outputImpliedClosingLine
|
|
@@ -271,14 +281,14 @@ class SegmentToPointPen(AbstractPen):
|
|
|
271
281
|
PointPen protocol.
|
|
272
282
|
"""
|
|
273
283
|
|
|
274
|
-
def __init__(self, pointPen, guessSmooth=True):
|
|
284
|
+
def __init__(self, pointPen, guessSmooth=True) -> None:
|
|
275
285
|
if guessSmooth:
|
|
276
286
|
self.pen = GuessSmoothPointPen(pointPen)
|
|
277
287
|
else:
|
|
278
288
|
self.pen = pointPen
|
|
279
|
-
self.contour = None
|
|
289
|
+
self.contour: Optional[List[Tuple[Point, SegmentType]]] = None
|
|
280
290
|
|
|
281
|
-
def _flushContour(self):
|
|
291
|
+
def _flushContour(self) -> None:
|
|
282
292
|
pen = self.pen
|
|
283
293
|
pen.beginPath()
|
|
284
294
|
for pt, segmentType in self.contour:
|
|
@@ -594,7 +604,6 @@ class DecomposingPointPen(LogMixin, AbstractPointPen):
|
|
|
594
604
|
# if the transformation has a negative determinant, it will
|
|
595
605
|
# reverse the contour direction of the component
|
|
596
606
|
a, b, c, d = transformation[:4]
|
|
597
|
-
det = a * d - b * c
|
|
598
607
|
if a * d - b * c < 0:
|
|
599
608
|
pen = ReverseContourPointPen(pen)
|
|
600
609
|
glyph.drawPoints(pen)
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
# Copyright (c) 2009 Type Supply LLC
|
|
2
2
|
# Author: Tal Leming
|
|
3
3
|
|
|
4
|
-
from
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
from typing import Any, Dict, List, Tuple
|
|
7
|
+
|
|
8
|
+
from fontTools.cffLib.specializer import commandsToProgram, specializeCommands
|
|
5
9
|
from fontTools.misc.psCharStrings import T2CharString
|
|
10
|
+
from fontTools.misc.roundTools import otRound, roundFunc
|
|
6
11
|
from fontTools.pens.basePen import BasePen
|
|
7
|
-
from fontTools.cffLib.specializer import specializeCommands, commandsToProgram
|
|
8
12
|
|
|
9
13
|
|
|
10
14
|
class T2CharStringPen(BasePen):
|
|
@@ -18,36 +22,52 @@ class T2CharStringPen(BasePen):
|
|
|
18
22
|
which are close to their integral part within the tolerated range.
|
|
19
23
|
"""
|
|
20
24
|
|
|
21
|
-
def __init__(
|
|
25
|
+
def __init__(
|
|
26
|
+
self,
|
|
27
|
+
width: float | None,
|
|
28
|
+
glyphSet: Dict[str, Any] | None,
|
|
29
|
+
roundTolerance: float = 0.5,
|
|
30
|
+
CFF2: bool = False,
|
|
31
|
+
) -> None:
|
|
22
32
|
super(T2CharStringPen, self).__init__(glyphSet)
|
|
23
33
|
self.round = roundFunc(roundTolerance)
|
|
24
34
|
self._CFF2 = CFF2
|
|
25
35
|
self._width = width
|
|
26
|
-
self._commands = []
|
|
36
|
+
self._commands: List[Tuple[str | bytes, List[float]]] = []
|
|
27
37
|
self._p0 = (0, 0)
|
|
28
38
|
|
|
29
|
-
def _p(self, pt):
|
|
39
|
+
def _p(self, pt: Tuple[float, float]) -> List[float]:
|
|
30
40
|
p0 = self._p0
|
|
31
41
|
pt = self._p0 = (self.round(pt[0]), self.round(pt[1]))
|
|
32
42
|
return [pt[0] - p0[0], pt[1] - p0[1]]
|
|
33
43
|
|
|
34
|
-
def _moveTo(self, pt):
|
|
44
|
+
def _moveTo(self, pt: Tuple[float, float]) -> None:
|
|
35
45
|
self._commands.append(("rmoveto", self._p(pt)))
|
|
36
46
|
|
|
37
|
-
def _lineTo(self, pt):
|
|
47
|
+
def _lineTo(self, pt: Tuple[float, float]) -> None:
|
|
38
48
|
self._commands.append(("rlineto", self._p(pt)))
|
|
39
49
|
|
|
40
|
-
def _curveToOne(
|
|
50
|
+
def _curveToOne(
|
|
51
|
+
self,
|
|
52
|
+
pt1: Tuple[float, float],
|
|
53
|
+
pt2: Tuple[float, float],
|
|
54
|
+
pt3: Tuple[float, float],
|
|
55
|
+
) -> None:
|
|
41
56
|
_p = self._p
|
|
42
57
|
self._commands.append(("rrcurveto", _p(pt1) + _p(pt2) + _p(pt3)))
|
|
43
58
|
|
|
44
|
-
def _closePath(self):
|
|
59
|
+
def _closePath(self) -> None:
|
|
45
60
|
pass
|
|
46
61
|
|
|
47
|
-
def _endPath(self):
|
|
62
|
+
def _endPath(self) -> None:
|
|
48
63
|
pass
|
|
49
64
|
|
|
50
|
-
def getCharString(
|
|
65
|
+
def getCharString(
|
|
66
|
+
self,
|
|
67
|
+
private: Dict | None = None,
|
|
68
|
+
globalSubrs: List | None = None,
|
|
69
|
+
optimize: bool = True,
|
|
70
|
+
) -> T2CharString:
|
|
51
71
|
commands = self._commands
|
|
52
72
|
if optimize:
|
|
53
73
|
maxstack = 48 if not self._CFF2 else 513
|