fonttools 4.57.0__cp312-cp312-win_amd64.whl → 4.58.1__cp312-cp312-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.

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.cp312-win_amd64.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.cp312-win_amd64.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.cp312-win_amd64.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.cp312-win_amd64.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.cp312-win_amd64.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.cp312-win_amd64.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
@@ -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, Dict
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 fontTools.misc.roundTools import otRound, roundFunc
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__(self, width, glyphSet, roundTolerance=0.5, CFF2=False):
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(self, pt1, pt2, pt3):
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(self, private=None, globalSubrs=None, optimize=True):
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