fonttools 4.57.0__cp39-cp39-win_amd64.whl → 4.58.1__cp39-cp39-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.cp39-win_amd64.pyd +0 -0
  5. fontTools/designspaceLib/statNames.py +14 -7
  6. fontTools/feaLib/ast.py +12 -9
  7. fontTools/feaLib/builder.py +75 -49
  8. fontTools/feaLib/lexer.cp39-win_amd64.pyd +0 -0
  9. fontTools/feaLib/parser.py +1 -39
  10. fontTools/fontBuilder.py +6 -0
  11. fontTools/merge/cmap.py +33 -1
  12. fontTools/merge/tables.py +12 -1
  13. fontTools/misc/bezierTools.cp39-win_amd64.pyd +0 -0
  14. fontTools/misc/etree.py +4 -27
  15. fontTools/misc/loggingTools.py +1 -1
  16. fontTools/misc/symfont.py +6 -8
  17. fontTools/mtiLib/__init__.py +1 -3
  18. fontTools/otlLib/builder.py +359 -145
  19. fontTools/otlLib/optimize/gpos.py +42 -62
  20. fontTools/pens/momentsPen.cp39-win_amd64.pyd +0 -0
  21. fontTools/pens/pointPen.py +21 -12
  22. fontTools/pens/t2CharStringPen.py +31 -11
  23. fontTools/qu2cu/qu2cu.cp39-win_amd64.pyd +0 -0
  24. fontTools/subset/__init__.py +12 -1
  25. fontTools/ttLib/tables/G_V_A_R_.py +5 -0
  26. fontTools/ttLib/tables/T_S_I__0.py +14 -3
  27. fontTools/ttLib/tables/T_S_I__5.py +16 -5
  28. fontTools/ttLib/tables/__init__.py +1 -0
  29. fontTools/ttLib/tables/_c_v_t.py +2 -0
  30. fontTools/ttLib/tables/_f_p_g_m.py +3 -1
  31. fontTools/ttLib/tables/_g_l_y_f.py +2 -6
  32. fontTools/ttLib/tables/_g_v_a_r.py +58 -15
  33. fontTools/ttLib/tables/_p_o_s_t.py +5 -2
  34. fontTools/ttLib/tables/otBase.py +1 -0
  35. fontTools/ufoLib/__init__.py +3 -3
  36. fontTools/ufoLib/converters.py +89 -25
  37. fontTools/ufoLib/errors.py +8 -0
  38. fontTools/ufoLib/etree.py +1 -1
  39. fontTools/ufoLib/filenames.py +155 -100
  40. fontTools/ufoLib/glifLib.py +9 -2
  41. fontTools/ufoLib/kerning.py +66 -36
  42. fontTools/ufoLib/utils.py +5 -2
  43. fontTools/unicodedata/Mirrored.py +446 -0
  44. fontTools/unicodedata/__init__.py +6 -2
  45. fontTools/varLib/__init__.py +20 -6
  46. fontTools/varLib/featureVars.py +13 -7
  47. fontTools/varLib/hvar.py +1 -1
  48. fontTools/varLib/instancer/__init__.py +14 -5
  49. fontTools/varLib/iup.cp39-win_amd64.pyd +0 -0
  50. fontTools/voltLib/__main__.py +206 -0
  51. fontTools/voltLib/ast.py +4 -0
  52. fontTools/voltLib/parser.py +16 -8
  53. fontTools/voltLib/voltToFea.py +347 -166
  54. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/METADATA +64 -11
  55. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/RECORD +61 -63
  56. {fonttools-4.57.0.dist-info → fonttools-4.58.1.dist-info}/WHEEL +1 -1
  57. fonttools-4.58.1.dist-info/licenses/LICENSE.external +359 -0
  58. fontTools/cu2qu/cu2qu.c +0 -14829
  59. fontTools/feaLib/lexer.c +0 -17986
  60. fontTools/misc/bezierTools.c +0 -41831
  61. fontTools/pens/momentsPen.c +0 -13448
  62. fontTools/qu2cu/qu2cu.c +0 -16269
  63. fontTools/varLib/iup.c +0 -19154
  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
fontTools/merge/cmap.py CHANGED
@@ -54,6 +54,28 @@ def _glyphsAreSame(
54
54
  return True
55
55
 
56
56
 
57
+ def computeMegaUvs(merger, uvsTables):
58
+ """Returns merged UVS subtable (cmap format=14)."""
59
+ uvsDict = {}
60
+ cmap = merger.cmap
61
+ for table in uvsTables:
62
+ for variationSelector, uvsMapping in table.uvsDict.items():
63
+ if variationSelector not in uvsDict:
64
+ uvsDict[variationSelector] = {}
65
+ for unicodeValue, glyphName in uvsMapping:
66
+ if cmap.get(unicodeValue) == glyphName:
67
+ # this is a default variation
68
+ glyphName = None
69
+ # prefer previous glyph id if both fonts defined UVS
70
+ if unicodeValue not in uvsDict[variationSelector]:
71
+ uvsDict[variationSelector][unicodeValue] = glyphName
72
+
73
+ for variationSelector in uvsDict:
74
+ uvsDict[variationSelector] = [*uvsDict[variationSelector].items()]
75
+
76
+ return uvsDict
77
+
78
+
57
79
  # Valid (format, platformID, platEncID) triplets for cmap subtables containing
58
80
  # Unicode BMP-only and Unicode Full Repertoire semantics.
59
81
  # Cf. OpenType spec for "Platform specific encodings":
@@ -61,24 +83,29 @@ def _glyphsAreSame(
61
83
  class _CmapUnicodePlatEncodings:
62
84
  BMP = {(4, 3, 1), (4, 0, 3), (4, 0, 4), (4, 0, 6)}
63
85
  FullRepertoire = {(12, 3, 10), (12, 0, 4), (12, 0, 6)}
86
+ UVS = {(14, 0, 5)}
64
87
 
65
88
 
66
89
  def computeMegaCmap(merger, cmapTables):
67
- """Sets merger.cmap and merger.glyphOrder."""
90
+ """Sets merger.cmap and merger.uvsDict."""
68
91
 
69
92
  # TODO Handle format=14.
70
93
  # Only merge format 4 and 12 Unicode subtables, ignores all other subtables
71
94
  # If there is a format 12 table for a font, ignore the format 4 table of it
72
95
  chosenCmapTables = []
96
+ chosenUvsTables = []
73
97
  for fontIdx, table in enumerate(cmapTables):
74
98
  format4 = None
75
99
  format12 = None
100
+ format14 = None
76
101
  for subtable in table.tables:
77
102
  properties = (subtable.format, subtable.platformID, subtable.platEncID)
78
103
  if properties in _CmapUnicodePlatEncodings.BMP:
79
104
  format4 = subtable
80
105
  elif properties in _CmapUnicodePlatEncodings.FullRepertoire:
81
106
  format12 = subtable
107
+ elif properties in _CmapUnicodePlatEncodings.UVS:
108
+ format14 = subtable
82
109
  else:
83
110
  log.warning(
84
111
  "Dropped cmap subtable from font '%s':\t"
@@ -93,6 +120,9 @@ def computeMegaCmap(merger, cmapTables):
93
120
  elif format4 is not None:
94
121
  chosenCmapTables.append((format4, fontIdx))
95
122
 
123
+ if format14 is not None:
124
+ chosenUvsTables.append(format14)
125
+
96
126
  # Build the unicode mapping
97
127
  merger.cmap = cmap = {}
98
128
  fontIndexForGlyph = {}
@@ -127,6 +157,8 @@ def computeMegaCmap(merger, cmapTables):
127
157
  "Dropped mapping from codepoint %#06X to glyphId '%s'", uni, gid
128
158
  )
129
159
 
160
+ merger.uvsDict = computeMegaUvs(merger, chosenUvsTables)
161
+
130
162
 
131
163
  def renameCFFCharStrings(merger, glyphOrder, cffTable):
132
164
  """Rename topDictIndex charStrings based on glyphOrder."""
fontTools/merge/tables.py CHANGED
@@ -312,7 +312,6 @@ def merge(self, m, tables):
312
312
 
313
313
  @add_method(ttLib.getTableClass("cmap"))
314
314
  def merge(self, m, tables):
315
- # TODO Handle format=14.
316
315
  if not hasattr(m, "cmap"):
317
316
  computeMegaCmap(m, tables)
318
317
  cmap = m.cmap
@@ -336,6 +335,18 @@ def merge(self, m, tables):
336
335
  cmapTable.cmap = cmapBmpOnly
337
336
  # ordered by platform then encoding
338
337
  self.tables.insert(0, cmapTable)
338
+
339
+ uvsDict = m.uvsDict
340
+ if uvsDict:
341
+ # format-14
342
+ uvsTable = module.cmap_classes[14](14)
343
+ uvsTable.platformID = 0
344
+ uvsTable.platEncID = 5
345
+ uvsTable.language = 0
346
+ uvsTable.cmap = {}
347
+ uvsTable.uvsDict = uvsDict
348
+ # ordered by platform then encoding
349
+ self.tables.insert(0, uvsTable)
339
350
  self.tableVersion = 0
340
351
  self.numSubTables = len(self.tables)
341
352
  return self
fontTools/misc/etree.py CHANGED
@@ -56,21 +56,7 @@ except ImportError:
56
56
  from xml.etree.ElementTree import *
57
57
  _have_lxml = False
58
58
 
59
- import sys
60
-
61
- # dict is always ordered in python >= 3.6 and on pypy
62
- PY36 = sys.version_info >= (3, 6)
63
- try:
64
- import __pypy__
65
- except ImportError:
66
- __pypy__ = None
67
- _dict_is_ordered = bool(PY36 or __pypy__)
68
- del PY36, __pypy__
69
-
70
- if _dict_is_ordered:
71
- _Attrib = dict
72
- else:
73
- from collections import OrderedDict as _Attrib
59
+ _Attrib = dict
74
60
 
75
61
  if isinstance(Element, type):
76
62
  _Element = Element
@@ -221,18 +207,9 @@ except ImportError:
221
207
  # characters, the surrogate blocks, FFFE, and FFFF:
222
208
  # Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
223
209
  # Here we reversed the pattern to match only the invalid characters.
224
- # For the 'narrow' python builds supporting only UCS-2, which represent
225
- # characters beyond BMP as UTF-16 surrogate pairs, we need to pass through
226
- # the surrogate block. I haven't found a more elegant solution...
227
- UCS2 = sys.maxunicode < 0x10FFFF
228
- if UCS2:
229
- _invalid_xml_string = re.compile(
230
- "[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uFFFE-\uFFFF]"
231
- )
232
- else:
233
- _invalid_xml_string = re.compile(
234
- "[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]"
235
- )
210
+ _invalid_xml_string = re.compile(
211
+ "[\u0000-\u0008\u000B-\u000C\u000E-\u001F\uD800-\uDFFF\uFFFE-\uFFFF]"
212
+ )
236
213
 
237
214
  def _tounicode(s):
238
215
  """Test if a string is valid user input and decode it to unicode string
@@ -284,7 +284,7 @@ class Timer(object):
284
284
  """
285
285
 
286
286
  # timeit.default_timer choses the most accurate clock for each platform
287
- _time = timeit.default_timer
287
+ _time: Callable[[], float] = staticmethod(timeit.default_timer)
288
288
  default_msg = "elapsed time: %(time).3fs"
289
289
  default_format = "Took %(time).3fs to %(msg)s"
290
290
 
fontTools/misc/symfont.py CHANGED
@@ -234,11 +234,9 @@ if __name__ == '__main__':
234
234
 
235
235
 
236
236
  if __name__ == "__main__":
237
- pen = AreaPen()
238
- pen.moveTo((100, 100))
239
- pen.lineTo((100, 200))
240
- pen.lineTo((200, 200))
241
- pen.curveTo((200, 250), (300, 300), (250, 350))
242
- pen.lineTo((200, 100))
243
- pen.closePath()
244
- print(pen.value)
237
+ import sys
238
+
239
+ if sys.argv[1:]:
240
+ penName = sys.argv[1]
241
+ funcs = [(name, eval(f)) for name, f in zip(sys.argv[2::2], sys.argv[3::2])]
242
+ printGreenPen(penName, funcs, file=sys.stdout)
@@ -1,5 +1,3 @@
1
- #!/usr/bin/python
2
-
3
1
  # FontDame-to-FontTools for OpenType Layout tables
4
2
  #
5
3
  # Source language spec is available at:
@@ -1377,7 +1375,7 @@ def main(args=None, font=None):
1377
1375
 
1378
1376
  for f in args.inputs:
1379
1377
  log.debug("Processing %s", f)
1380
- with open(f, "rt", encoding="utf-8") as f:
1378
+ with open(f, "rt", encoding="utf-8-sig") as f:
1381
1379
  table = build(f, font, tableTag=args.tableTag)
1382
1380
  blob = table.compile(font) # Make sure it compiles
1383
1381
  decompiled = table.__class__()