fonttools 4.57.0__py3-none-any.whl → 4.58.0__py3-none-any.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 (46) hide show
  1. fontTools/__init__.py +1 -1
  2. fontTools/cffLib/__init__.py +61 -26
  3. fontTools/designspaceLib/statNames.py +14 -7
  4. fontTools/feaLib/ast.py +84 -10
  5. fontTools/feaLib/builder.py +20 -4
  6. fontTools/feaLib/parser.py +1 -39
  7. fontTools/fontBuilder.py +6 -0
  8. fontTools/misc/etree.py +4 -27
  9. fontTools/mtiLib/__init__.py +0 -2
  10. fontTools/otlLib/builder.py +195 -145
  11. fontTools/otlLib/optimize/gpos.py +42 -62
  12. fontTools/pens/pointPen.py +21 -12
  13. fontTools/subset/__init__.py +11 -0
  14. fontTools/ttLib/tables/G_V_A_R_.py +5 -0
  15. fontTools/ttLib/tables/T_S_I__0.py +14 -3
  16. fontTools/ttLib/tables/T_S_I__5.py +16 -5
  17. fontTools/ttLib/tables/__init__.py +1 -0
  18. fontTools/ttLib/tables/_c_v_t.py +2 -0
  19. fontTools/ttLib/tables/_f_p_g_m.py +3 -1
  20. fontTools/ttLib/tables/_g_l_y_f.py +2 -6
  21. fontTools/ttLib/tables/_g_v_a_r.py +58 -15
  22. fontTools/ttLib/tables/_p_o_s_t.py +5 -2
  23. fontTools/ttLib/tables/otBase.py +1 -0
  24. fontTools/ufoLib/__init__.py +2 -2
  25. fontTools/ufoLib/converters.py +89 -25
  26. fontTools/ufoLib/errors.py +8 -0
  27. fontTools/ufoLib/etree.py +1 -1
  28. fontTools/ufoLib/filenames.py +155 -100
  29. fontTools/ufoLib/glifLib.py +9 -2
  30. fontTools/ufoLib/kerning.py +66 -36
  31. fontTools/ufoLib/utils.py +5 -2
  32. fontTools/unicodedata/Mirrored.py +446 -0
  33. fontTools/unicodedata/__init__.py +6 -2
  34. fontTools/varLib/__init__.py +2 -0
  35. fontTools/voltLib/__main__.py +206 -0
  36. fontTools/voltLib/ast.py +4 -0
  37. fontTools/voltLib/parser.py +16 -8
  38. fontTools/voltLib/voltToFea.py +347 -166
  39. {fonttools-4.57.0.dist-info → fonttools-4.58.0.dist-info}/METADATA +45 -11
  40. {fonttools-4.57.0.dist-info → fonttools-4.58.0.dist-info}/RECORD +46 -42
  41. {fonttools-4.57.0.dist-info → fonttools-4.58.0.dist-info}/WHEEL +1 -1
  42. fonttools-4.58.0.dist-info/licenses/LICENSE.external +359 -0
  43. {fonttools-4.57.0.data → fonttools-4.58.0.data}/data/share/man/man1/ttx.1 +0 -0
  44. {fonttools-4.57.0.dist-info → fonttools-4.58.0.dist-info}/entry_points.txt +0 -0
  45. {fonttools-4.57.0.dist-info → fonttools-4.58.0.dist-info}/licenses/LICENSE +0 -0
  46. {fonttools-4.57.0.dist-info → fonttools-4.58.0.dist-info}/top_level.txt +0 -0
@@ -313,19 +313,27 @@ class Parser(object):
313
313
  self.expect_keyword_("END_SUBSTITUTION")
314
314
  max_src = max([len(cov) for cov in src])
315
315
  max_dest = max([len(cov) for cov in dest])
316
+
316
317
  # many to many or mixed is invalid
317
- if (max_src > 1 and max_dest > 1) or (
318
- reversal and (max_src > 1 or max_dest > 1)
319
- ):
318
+ if max_src > 1 and max_dest > 1:
320
319
  raise VoltLibError("Invalid substitution type", location)
320
+
321
321
  mapping = dict(zip(tuple(src), tuple(dest)))
322
322
  if max_src == 1 and max_dest == 1:
323
- if reversal:
324
- sub = ast.SubstitutionReverseChainingSingleDefinition(
325
- mapping, location=location
326
- )
323
+ # Alternate substitutions are represented by adding multiple
324
+ # substitutions for the same glyph, so we detect that here
325
+ glyphs = [x.glyphSet() for cov in src for x in cov] # flatten src
326
+ if len(set(glyphs)) != len(glyphs): # src has duplicates
327
+ sub = ast.SubstitutionAlternateDefinition(mapping, location=location)
327
328
  else:
328
- sub = ast.SubstitutionSingleDefinition(mapping, location=location)
329
+ if reversal:
330
+ # Reversal is valid only for single glyph substitutions
331
+ # and VOLT ignores it otherwise.
332
+ sub = ast.SubstitutionReverseChainingSingleDefinition(
333
+ mapping, location=location
334
+ )
335
+ else:
336
+ sub = ast.SubstitutionSingleDefinition(mapping, location=location)
329
337
  elif max_src == 1 and max_dest > 1:
330
338
  sub = ast.SubstitutionMultipleDefinition(mapping, location=location)
331
339
  elif max_src > 1 and max_dest == 1: