fonttools 4.55.2__cp311-cp311-musllinux_1_2_aarch64.whl → 4.55.6__cp311-cp311-musllinux_1_2_aarch64.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 (99) hide show
  1. fontTools/__init__.py +1 -1
  2. fontTools/feaLib/ast.py +2 -2
  3. fontTools/feaLib/builder.py +29 -4
  4. fontTools/misc/bezierTools.c +3256 -2972
  5. fontTools/misc/bezierTools.cpython-311-aarch64-linux-musl.so +0 -0
  6. fontTools/misc/bezierTools.py +8 -1
  7. fontTools/misc/transform.py +13 -15
  8. fontTools/otlLib/builder.py +17 -0
  9. fontTools/pens/statisticsPen.py +5 -0
  10. fontTools/ttLib/tables/B_A_S_E_.py +9 -0
  11. fontTools/ttLib/tables/C_B_D_T_.py +10 -0
  12. fontTools/ttLib/tables/C_B_L_C_.py +10 -0
  13. fontTools/ttLib/tables/C_F_F_.py +15 -0
  14. fontTools/ttLib/tables/C_F_F__2.py +13 -0
  15. fontTools/ttLib/tables/C_O_L_R_.py +9 -1
  16. fontTools/ttLib/tables/C_P_A_L_.py +9 -0
  17. fontTools/ttLib/tables/D_S_I_G_.py +7 -0
  18. fontTools/ttLib/tables/E_B_D_T_.py +8 -0
  19. fontTools/ttLib/tables/E_B_L_C_.py +8 -0
  20. fontTools/ttLib/tables/F_F_T_M_.py +10 -0
  21. fontTools/ttLib/tables/F__e_a_t.py +7 -2
  22. fontTools/ttLib/tables/G_D_E_F_.py +8 -0
  23. fontTools/ttLib/tables/G_M_A_P_.py +7 -0
  24. fontTools/ttLib/tables/G_P_K_G_.py +7 -0
  25. fontTools/ttLib/tables/G_P_O_S_.py +9 -0
  26. fontTools/ttLib/tables/G_S_U_B_.py +8 -0
  27. fontTools/ttLib/tables/G__l_a_t.py +3 -2
  28. fontTools/ttLib/tables/G__l_o_c.py +3 -2
  29. fontTools/ttLib/tables/H_V_A_R_.py +8 -0
  30. fontTools/ttLib/tables/J_S_T_F_.py +8 -0
  31. fontTools/ttLib/tables/L_T_S_H_.py +10 -0
  32. fontTools/ttLib/tables/M_A_T_H_.py +8 -0
  33. fontTools/ttLib/tables/M_E_T_A_.py +7 -0
  34. fontTools/ttLib/tables/M_V_A_R_.py +8 -0
  35. fontTools/ttLib/tables/O_S_2f_2.py +8 -1
  36. fontTools/ttLib/tables/S_I_N_G_.py +7 -0
  37. fontTools/ttLib/tables/S_T_A_T_.py +10 -0
  38. fontTools/ttLib/tables/S_V_G_.py +8 -0
  39. fontTools/ttLib/tables/S__i_l_f.py +4 -1
  40. fontTools/ttLib/tables/S__i_l_l.py +5 -0
  41. fontTools/ttLib/tables/T_S_I_B_.py +8 -0
  42. fontTools/ttLib/tables/T_S_I_C_.py +9 -0
  43. fontTools/ttLib/tables/T_S_I_D_.py +8 -0
  44. fontTools/ttLib/tables/T_S_I_J_.py +8 -0
  45. fontTools/ttLib/tables/T_S_I_P_.py +8 -0
  46. fontTools/ttLib/tables/T_S_I_S_.py +8 -0
  47. fontTools/ttLib/tables/T_S_I_V_.py +6 -0
  48. fontTools/ttLib/tables/T_S_I__0.py +2 -0
  49. fontTools/ttLib/tables/T_S_I__1.py +2 -0
  50. fontTools/ttLib/tables/T_S_I__2.py +2 -0
  51. fontTools/ttLib/tables/T_S_I__3.py +2 -0
  52. fontTools/ttLib/tables/T_S_I__5.py +2 -0
  53. fontTools/ttLib/tables/T_T_F_A_.py +9 -0
  54. fontTools/ttLib/tables/V_A_R_C_.py +7 -0
  55. fontTools/ttLib/tables/V_D_M_X_.py +8 -0
  56. fontTools/ttLib/tables/V_O_R_G_.py +8 -1
  57. fontTools/ttLib/tables/V_V_A_R_.py +8 -0
  58. fontTools/ttLib/tables/_a_n_k_r.py +3 -2
  59. fontTools/ttLib/tables/_a_v_a_r.py +3 -1
  60. fontTools/ttLib/tables/_b_s_l_n.py +9 -0
  61. fontTools/ttLib/tables/_c_i_d_g.py +7 -2
  62. fontTools/ttLib/tables/_c_m_a_p.py +2 -0
  63. fontTools/ttLib/tables/_c_v_a_r.py +8 -0
  64. fontTools/ttLib/tables/_c_v_t.py +8 -0
  65. fontTools/ttLib/tables/_f_e_a_t.py +7 -4
  66. fontTools/ttLib/tables/_f_p_g_m.py +11 -0
  67. fontTools/ttLib/tables/_f_v_a_r.py +8 -0
  68. fontTools/ttLib/tables/_g_a_s_p.py +8 -0
  69. fontTools/ttLib/tables/_g_c_i_d.py +7 -0
  70. fontTools/ttLib/tables/_g_l_y_f.py +31 -7
  71. fontTools/ttLib/tables/_g_v_a_r.py +11 -3
  72. fontTools/ttLib/tables/_h_d_m_x.py +8 -0
  73. fontTools/ttLib/tables/_h_e_a_d.py +7 -0
  74. fontTools/ttLib/tables/_h_h_e_a.py +12 -0
  75. fontTools/ttLib/tables/_h_m_t_x.py +9 -0
  76. fontTools/ttLib/tables/_k_e_r_n.py +11 -0
  77. fontTools/ttLib/tables/_l_c_a_r.py +8 -0
  78. fontTools/ttLib/tables/_l_o_c_a.py +8 -0
  79. fontTools/ttLib/tables/_l_t_a_g.py +8 -0
  80. fontTools/ttLib/tables/_m_a_x_p.py +8 -0
  81. fontTools/ttLib/tables/_m_e_t_a.py +8 -0
  82. fontTools/ttLib/tables/_m_o_r_t.py +8 -0
  83. fontTools/ttLib/tables/_m_o_r_x.py +9 -0
  84. fontTools/ttLib/tables/_n_a_m_e.py +15 -13
  85. fontTools/ttLib/tables/_o_p_b_d.py +8 -0
  86. fontTools/ttLib/tables/_p_o_s_t.py +9 -0
  87. fontTools/ttLib/tables/_p_r_e_p.py +9 -0
  88. fontTools/ttLib/tables/_p_r_o_p.py +6 -0
  89. fontTools/ttLib/tables/_s_b_i_x.py +10 -0
  90. fontTools/ttLib/tables/_t_r_a_k.py +7 -0
  91. fontTools/ttLib/tables/_v_h_e_a.py +12 -0
  92. fontTools/ttLib/tables/_v_m_t_x.py +9 -0
  93. {fonttools-4.55.2.dist-info → fonttools-4.55.6.dist-info}/METADATA +38 -3
  94. {fonttools-4.55.2.dist-info → fonttools-4.55.6.dist-info}/RECORD +292 -292
  95. {fonttools-4.55.2.dist-info → fonttools-4.55.6.dist-info}/WHEEL +1 -1
  96. {fonttools-4.55.2.data → fonttools-4.55.6.data}/data/share/man/man1/ttx.1 +0 -0
  97. {fonttools-4.55.2.dist-info → fonttools-4.55.6.dist-info}/LICENSE +0 -0
  98. {fonttools-4.55.2.dist-info → fonttools-4.55.6.dist-info}/entry_points.txt +0 -0
  99. {fonttools-4.55.2.dist-info → fonttools-4.55.6.dist-info}/top_level.txt +0 -0
@@ -343,7 +343,10 @@ class _Object:
343
343
 
344
344
 
345
345
  class table_S__i_l_f(DefaultTable.DefaultTable):
346
- """Silf table support"""
346
+ """Graphite Rules table
347
+
348
+ See also https://graphite.sil.org/graphite_techAbout#graphite-font-tables
349
+ """
347
350
 
348
351
  def __init__(self, tag=None):
349
352
  DefaultTable.DefaultTable.__init__(self, tag)
@@ -12,6 +12,11 @@ Sill_hdr = """
12
12
 
13
13
 
14
14
  class table_S__i_l_l(DefaultTable.DefaultTable):
15
+ """Graphite Languages table
16
+
17
+ See also https://graphite.sil.org/graphite_techAbout#graphite-font-tables
18
+ """
19
+
15
20
  def __init__(self, tag=None):
16
21
  DefaultTable.DefaultTable.__init__(self, tag)
17
22
  self.langs = {}
@@ -1,3 +1,11 @@
1
+ """ TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT)
2
+ tool to store its table source data.
3
+
4
+ TSIB contains the source text for the ``BASE`` table.
5
+
6
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
7
+ """
8
+
1
9
  from .T_S_I_V_ import table_T_S_I_V_
2
10
 
3
11
 
@@ -1,3 +1,12 @@
1
+ """ TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT)
2
+ tool to store its table source data.
3
+
4
+ TSIC contains the source text for the Variation CVT window and data for
5
+ the ``cvar`` table.
6
+
7
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
8
+ """
9
+
1
10
  from .otBase import BaseTTXConverter
2
11
 
3
12
 
@@ -1,3 +1,11 @@
1
+ """ TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT)
2
+ tool to store its table source data.
3
+
4
+ TSID contains the source text for the ``GDEF`` table.
5
+
6
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
7
+ """
8
+
1
9
  from .T_S_I_V_ import table_T_S_I_V_
2
10
 
3
11
 
@@ -1,3 +1,11 @@
1
+ """ TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT)
2
+ tool to store its table source data.
3
+
4
+ TSIJ contains the source text for the ``JSTF`` table.
5
+
6
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
7
+ """
8
+
1
9
  from .T_S_I_V_ import table_T_S_I_V_
2
10
 
3
11
 
@@ -1,3 +1,11 @@
1
+ """ TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT)
2
+ tool to store its table source data.
3
+
4
+ TSIP contains the source text for the ``GPOS`` table.
5
+
6
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
7
+ """
8
+
1
9
  from .T_S_I_V_ import table_T_S_I_V_
2
10
 
3
11
 
@@ -1,3 +1,11 @@
1
+ """ TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT)
2
+ tool to store its table source data.
3
+
4
+ TSIS contains the source text for the ``GSUB`` table.
5
+
6
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
7
+ """
8
+
1
9
  from .T_S_I_V_ import table_T_S_I_V_
2
10
 
3
11
 
@@ -1,3 +1,9 @@
1
+ """ TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT)
2
+ tool to store its table source data.
3
+
4
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
5
+ """
6
+
1
7
  from fontTools.misc.textTools import strjoin, tobytes, tostr
2
8
  from . import asciiTable
3
9
 
@@ -4,6 +4,8 @@ tool to store its hinting source data.
4
4
  TSI0 is the index table containing the lengths and offsets for the glyph
5
5
  programs and 'extra' programs ('fpgm', 'prep', and 'cvt') that are contained
6
6
  in the TSI1 table.
7
+
8
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
7
9
  """
8
10
 
9
11
  from . import DefaultTable
@@ -3,6 +3,8 @@ tool to store its hinting source data.
3
3
 
4
4
  TSI1 contains the text of the glyph programs in the form of low-level assembly
5
5
  code, as well as the 'extra' programs 'fpgm', 'ppgm' (i.e. 'prep'), and 'cvt'.
6
+
7
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
6
8
  """
7
9
 
8
10
  from . import DefaultTable
@@ -4,6 +4,8 @@ tool to store its hinting source data.
4
4
  TSI2 is the index table containing the lengths and offsets for the glyph
5
5
  programs that are contained in the TSI3 table. It uses the same format as
6
6
  the TSI0 table.
7
+
8
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
7
9
  """
8
10
 
9
11
  from fontTools import ttLib
@@ -2,6 +2,8 @@
2
2
  tool to store its hinting source data.
3
3
 
4
4
  TSI3 contains the text of the glyph programs in the form of 'VTTTalk' code.
5
+
6
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
5
7
  """
6
8
 
7
9
  from fontTools import ttLib
@@ -2,6 +2,8 @@
2
2
  tool to store its hinting source data.
3
3
 
4
4
  TSI5 contains the VTT character groups.
5
+
6
+ See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables
5
7
  """
6
8
 
7
9
  from fontTools.misc.textTools import safeEval
@@ -2,4 +2,13 @@ from . import asciiTable
2
2
 
3
3
 
4
4
  class table_T_T_F_A_(asciiTable.asciiTable):
5
+ """ttfautohint parameters table
6
+
7
+ The ``TTFA`` table is used by the free-software `ttfautohint` program
8
+ to record the parameters that `ttfautohint` was called with when it
9
+ was used to auto-hint the font.
10
+
11
+ See also http://freetype.org/ttfautohint/doc/ttfautohint.html#miscellaneous-1
12
+ """
13
+
5
14
  pass
@@ -2,4 +2,11 @@ from .otBase import BaseTTXConverter
2
2
 
3
3
 
4
4
  class table_V_A_R_C_(BaseTTXConverter):
5
+ """Variable Components table
6
+
7
+ The ``VARC`` table contains variation information for composite glyphs.
8
+
9
+ See also https://github.com/harfbuzz/boring-expansion-spec/blob/main/VARC.md
10
+ """
11
+
5
12
  pass
@@ -37,6 +37,14 @@ VDMX_vTableFmt = """
37
37
 
38
38
 
39
39
  class table_V_D_M_X_(DefaultTable.DefaultTable):
40
+ """Vertical Device Metrics table
41
+
42
+ The ``VDMX`` table records changes to the vertical glyph minima
43
+ and maxima that result from Truetype instructions.
44
+
45
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/vdmx
46
+ """
47
+
40
48
  def decompile(self, data, ttFont):
41
49
  pos = 0 # track current position from to start of VDMX table
42
50
  dummy, data = sstruct.unpack2(VDMX_HeaderFmt, data, self)
@@ -4,11 +4,18 @@ import struct
4
4
 
5
5
 
6
6
  class table_V_O_R_G_(DefaultTable.DefaultTable):
7
- """This table is structured so that you can treat it like a dictionary keyed by glyph name.
7
+ """Vertical Origin table
8
+
9
+ The ``VORG`` table contains the vertical origin of each glyph
10
+ in a `CFF` or `CFF2` font.
11
+
12
+ This table is structured so that you can treat it like a dictionary keyed by glyph name.
8
13
 
9
14
  ``ttFont['VORG'][<glyphName>]`` will return the vertical origin for any glyph.
10
15
 
11
16
  ``ttFont['VORG'][<glyphName>] = <value>`` will set the vertical origin for any glyph.
17
+
18
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/vorg
12
19
  """
13
20
 
14
21
  def decompile(self, data, ttFont):
@@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter
2
2
 
3
3
 
4
4
  class table_V_V_A_R_(BaseTTXConverter):
5
+ """Vertical Metrics Variations table
6
+
7
+ The ``VVAR`` table contains variation data for per-glyph vertical metrics
8
+ in a variable font.
9
+
10
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/vvar
11
+ """
12
+
5
13
  pass
@@ -2,11 +2,12 @@ from .otBase import BaseTTXConverter
2
2
 
3
3
 
4
4
  class table__a_n_k_r(BaseTTXConverter):
5
- """
5
+ """Anchor Point table
6
+
6
7
  The anchor point table provides a way to define anchor points.
7
8
  These are points within the coordinate space of a given glyph,
8
9
  independent of the control points used to render the glyph.
9
- Anchor points are used in conjunction with the 'kerx' table.
10
+ Anchor points are used in conjunction with the ``kerx`` table.
10
11
 
11
12
  See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ankr.html
12
13
  """
@@ -22,7 +22,7 @@ from .otBase import BaseTTXConverter
22
22
 
23
23
 
24
24
  class table__a_v_a_r(BaseTTXConverter):
25
- """Axis Variations Table
25
+ """Axis Variations table
26
26
 
27
27
  This class represents the ``avar`` table of a variable font. The object has one
28
28
  substantive attribute, ``segments``, which maps axis tags to a segments dictionary::
@@ -43,6 +43,8 @@ class table__a_v_a_r(BaseTTXConverter):
43
43
  ``avar`` segment mapping must contain the entries ``-1.0: -1.0, 0.0: 0.0, 1.0: 1.0``.
44
44
  fontTools does not enforce this, so it is your responsibility to ensure that
45
45
  mappings are valid.
46
+
47
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/avar
46
48
  """
47
49
 
48
50
  dependencies = ["fvar"]
@@ -3,4 +3,13 @@ from .otBase import BaseTTXConverter
3
3
 
4
4
  # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bsln.html
5
5
  class table__b_s_l_n(BaseTTXConverter):
6
+ """Baseline table
7
+
8
+ The AAT ``bsln`` table is similar in purpose to the OpenType ``BASE``
9
+ table; it stores per-script baselines to support automatic alignment
10
+ of lines of text.
11
+
12
+ See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bsln.html
13
+ """
14
+
6
15
  pass
@@ -3,7 +3,9 @@ from .otBase import BaseTTXConverter
3
3
 
4
4
 
5
5
  class table__c_i_d_g(BaseTTXConverter):
6
- """The AAT ``cidg`` table has almost the same structure as ``gidc``,
6
+ """CID to Glyph ID table
7
+
8
+ The AAT ``cidg`` table has almost the same structure as ``gidc``,
7
9
  just mapping CIDs to GlyphIDs instead of the reverse direction.
8
10
 
9
11
  It is useful for fonts that may be used by a PDF renderer in lieu of
@@ -14,6 +16,9 @@ class table__c_i_d_g(BaseTTXConverter):
14
16
  obsoleted by ``cidg``.
15
17
 
16
18
  For example, the first font in ``/System/Library/Fonts/PingFang.ttc``
17
- (which Apple ships pre-installed on MacOS 10.12.6) has a ``cidg`` table."""
19
+ (which Apple ships pre-installed on MacOS 10.12.6) has a ``cidg`` table.
20
+
21
+ See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gcid.html
22
+ """
18
23
 
19
24
  pass
@@ -54,6 +54,8 @@ class table__c_m_a_p(DefaultTable.DefaultTable):
54
54
  cmap = newTable("cmap")
55
55
  cmap.tableVersion = 0
56
56
  cmap.tables = [cmap4_0_3]
57
+
58
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/cmap
57
59
  """
58
60
 
59
61
  def getcmap(self, platformID, platEncID):
@@ -24,6 +24,14 @@ CVAR_HEADER_SIZE = sstruct.calcsize(CVAR_HEADER_FORMAT)
24
24
 
25
25
 
26
26
  class table__c_v_a_r(DefaultTable.DefaultTable):
27
+ """Control Value Table (CVT) variations table
28
+
29
+ The ``cvar`` table contains variations for the values in a ``cvt``
30
+ table.
31
+
32
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/cvar
33
+ """
34
+
27
35
  dependencies = ["cvt ", "fvar"]
28
36
 
29
37
  def __init__(self, tag=None):
@@ -5,6 +5,14 @@ import array
5
5
 
6
6
 
7
7
  class table__c_v_t(DefaultTable.DefaultTable):
8
+ """Control Value Table
9
+
10
+ The Control Value Table holds a list of values that can be referenced
11
+ by TrueType font instructions.
12
+
13
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/cvt
14
+ """
15
+
8
16
  def decompile(self, data, ttFont):
9
17
  values = array.array("h")
10
18
  values.frombytes(data)
@@ -2,11 +2,14 @@ from .otBase import BaseTTXConverter
2
2
 
3
3
 
4
4
  class table__f_e_a_t(BaseTTXConverter):
5
- """The feature name table is an AAT (Apple Advanced Typography) table for
5
+ """Feature name table
6
+
7
+ The feature name table is an AAT (Apple Advanced Typography) table for
6
8
  storing font features, settings, and their human-readable names. It should
7
9
  not be confused with the ``Feat`` table or the OpenType Layout ``GSUB``/``GPOS``
8
- tables. See `Feature Name Table <https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6feat.html>`_
9
- in the TrueType Reference Manual for more information on the structure and
10
- purpose of this table."""
10
+ tables.
11
+
12
+ See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6feat.html
13
+ """
11
14
 
12
15
  pass
@@ -3,6 +3,17 @@ from . import ttProgram
3
3
 
4
4
 
5
5
  class table__f_p_g_m(DefaultTable.DefaultTable):
6
+ """Font Program table
7
+
8
+ The ``fpgm`` table typically contains function defintions that are
9
+ used by font instructions. This Font Program is similar to the Control
10
+ Value Program that is stored in the ``prep`` table, but
11
+ the ``fpgm`` table is only executed one time, when the font is first
12
+ used.
13
+
14
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/fpgm
15
+ """
16
+
6
17
  def decompile(self, data, ttFont):
7
18
  program = ttProgram.Program()
8
19
  program.fromBytecode(data)
@@ -43,6 +43,14 @@ FVAR_INSTANCE_FORMAT = """
43
43
 
44
44
 
45
45
  class table__f_v_a_r(DefaultTable.DefaultTable):
46
+ """FonT Variations table
47
+
48
+ The ``fvar`` table contains records of the variation axes and of the
49
+ named instances in a variable font.
50
+
51
+ See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fvar.html
52
+ """
53
+
46
54
  dependencies = ["name"]
47
55
 
48
56
  def __init__(self, tag=None):
@@ -10,6 +10,14 @@ GASP_GRIDFIT = 0x0001
10
10
 
11
11
 
12
12
  class table__g_a_s_p(DefaultTable.DefaultTable):
13
+ """Grid-fitting and Scan-conversion Procedure table
14
+
15
+ The ``gasp`` table defines the preferred rasterization settings for
16
+ the font when rendered on monochrome and greyscale output devices.
17
+
18
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/gasp
19
+ """
20
+
13
21
  def decompile(self, data, ttFont):
14
22
  self.version, numRanges = struct.unpack(">HH", data[:4])
15
23
  assert 0 <= self.version <= 1, "unknown 'gasp' format: %s" % self.version
@@ -3,4 +3,11 @@ from .otBase import BaseTTXConverter
3
3
 
4
4
  # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gcid.html
5
5
  class table__g_c_i_d(BaseTTXConverter):
6
+ """Glyph ID to CID table
7
+
8
+ The AAT ``gcid`` table stores glyphID-to-CID mappings.
9
+
10
+ See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gcid.html
11
+ """
12
+
6
13
  pass
@@ -54,7 +54,7 @@ SCALE_COMPONENT_OFFSET_DEFAULT = 0 # 0 == MS, 1 == Apple
54
54
 
55
55
 
56
56
  class table__g_l_y_f(DefaultTable.DefaultTable):
57
- """Glyph Data Table
57
+ """Glyph Data table
58
58
 
59
59
  This class represents the `glyf <https://docs.microsoft.com/en-us/typography/opentype/spec/glyf>`_
60
60
  table, which contains outlines for glyphs in TrueType format. In many cases,
@@ -1187,7 +1187,7 @@ class Glyph(object):
1187
1187
  ):
1188
1188
  return
1189
1189
  try:
1190
- coords, endPts, flags = self.getCoordinates(glyfTable)
1190
+ coords, endPts, flags = self.getCoordinates(glyfTable, round=otRound)
1191
1191
  self.xMin, self.yMin, self.xMax, self.yMax = coords.calcIntBounds()
1192
1192
  except NotImplementedError:
1193
1193
  pass
@@ -1206,9 +1206,7 @@ class Glyph(object):
1206
1206
  Return True if bounds were calculated, False otherwise.
1207
1207
  """
1208
1208
  for compo in self.components:
1209
- if hasattr(compo, "firstPt") or hasattr(compo, "transform"):
1210
- return False
1211
- if not float(compo.x).is_integer() or not float(compo.y).is_integer():
1209
+ if not compo._hasOnlyIntegerTranslate():
1212
1210
  return False
1213
1211
 
1214
1212
  # All components are untransformed and have an integer x/y translate
@@ -1241,7 +1239,7 @@ class Glyph(object):
1241
1239
  else:
1242
1240
  return self.numberOfContours == -1
1243
1241
 
1244
- def getCoordinates(self, glyfTable):
1242
+ def getCoordinates(self, glyfTable, *, round=noRound):
1245
1243
  """Return the coordinates, end points and flags
1246
1244
 
1247
1245
  This method returns three values: A :py:class:`GlyphCoordinates` object,
@@ -1267,13 +1265,27 @@ class Glyph(object):
1267
1265
  for compo in self.components:
1268
1266
  g = glyfTable[compo.glyphName]
1269
1267
  try:
1270
- coordinates, endPts, flags = g.getCoordinates(glyfTable)
1268
+ coordinates, endPts, flags = g.getCoordinates(
1269
+ glyfTable, round=round
1270
+ )
1271
1271
  except RecursionError:
1272
1272
  raise ttLib.TTLibError(
1273
1273
  "glyph '%s' contains a recursive component reference"
1274
1274
  % compo.glyphName
1275
1275
  )
1276
1276
  coordinates = GlyphCoordinates(coordinates)
1277
+ # if asked to round e.g. while computing bboxes, it's important we
1278
+ # do it immediately before a component transform is applied to a
1279
+ # simple glyph's coordinates in case these might still contain floats;
1280
+ # however, if the referenced component glyph is another composite, we
1281
+ # must not round here but only at the end, after all the nested
1282
+ # transforms have been applied, or else rounding errors will compound.
1283
+ if (
1284
+ round is not noRound
1285
+ and g.numberOfContours > 0
1286
+ and not compo._hasOnlyIntegerTranslate()
1287
+ ):
1288
+ coordinates.toInt(round=round)
1277
1289
  if hasattr(compo, "firstPt"):
1278
1290
  # component uses two reference points: we apply the transform _before_
1279
1291
  # computing the offset between the points
@@ -1930,6 +1942,18 @@ class GlyphComponent(object):
1930
1942
  result = self.__eq__(other)
1931
1943
  return result if result is NotImplemented else not result
1932
1944
 
1945
+ def _hasOnlyIntegerTranslate(self):
1946
+ """Return True if it's a 'simple' component.
1947
+
1948
+ That is, it has no anchor points and no transform other than integer translate.
1949
+ """
1950
+ return (
1951
+ not hasattr(self, "firstPt")
1952
+ and not hasattr(self, "transform")
1953
+ and float(self.x).is_integer()
1954
+ and float(self.y).is_integer()
1955
+ )
1956
+
1933
1957
 
1934
1958
  class GlyphCoordinates(object):
1935
1959
  """A list of glyph coordinates.
@@ -3,6 +3,7 @@ from functools import partial
3
3
  from fontTools.misc import sstruct
4
4
  from fontTools.misc.textTools import safeEval
5
5
  from fontTools.misc.lazyTools import LazyDict
6
+ from fontTools.ttLib.tables.TupleVariation import TupleVariation
6
7
  from . import DefaultTable
7
8
  import array
8
9
  import itertools
@@ -11,10 +12,7 @@ import struct
11
12
  import sys
12
13
  import fontTools.ttLib.tables.TupleVariation as tv
13
14
 
14
-
15
15
  log = logging.getLogger(__name__)
16
- TupleVariation = tv.TupleVariation
17
-
18
16
 
19
17
  # https://www.microsoft.com/typography/otspec/gvar.htm
20
18
  # https://www.microsoft.com/typography/otspec/otvarcommonformats.htm
@@ -41,6 +39,16 @@ GVAR_HEADER_SIZE = sstruct.calcsize(GVAR_HEADER_FORMAT)
41
39
 
42
40
 
43
41
  class table__g_v_a_r(DefaultTable.DefaultTable):
42
+ """Glyph Variations table
43
+
44
+ The ``gvar`` table provides the per-glyph variation data that
45
+ describe how glyph outlines in the ``glyf`` table change across
46
+ the variation space that is defined for the font in the ``fvar``
47
+ table.
48
+
49
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/gvar
50
+ """
51
+
44
52
  dependencies = ["fvar", "glyf"]
45
53
 
46
54
  def __init__(self, tag=None):
@@ -31,6 +31,14 @@ class _GlyphnamedList(Mapping):
31
31
 
32
32
 
33
33
  class table__h_d_m_x(DefaultTable.DefaultTable):
34
+ """Horizontal Device Metrics table
35
+
36
+ The ``hdmx`` table is an optional table that stores advance widths for
37
+ glyph outlines at specified pixel sizes.
38
+
39
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/hdmx
40
+ """
41
+
34
42
  def decompile(self, data, ttFont):
35
43
  numGlyphs = ttFont["maxp"].numGlyphs
36
44
  glyphOrder = ttFont.getGlyphOrder()
@@ -37,6 +37,13 @@ headFormat = """
37
37
 
38
38
 
39
39
  class table__h_e_a_d(DefaultTable.DefaultTable):
40
+ """Font Header table
41
+
42
+ The ``head`` table contains a variety of font-wide information.
43
+
44
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/head
45
+ """
46
+
40
47
  dependencies = ["maxp", "loca", "CFF ", "CFF2"]
41
48
 
42
49
  def decompile(self, data, ttFont):
@@ -31,6 +31,18 @@ hheaFormat = """
31
31
 
32
32
 
33
33
  class table__h_h_e_a(DefaultTable.DefaultTable):
34
+ """Horizontal Header table
35
+
36
+ The ``hhea`` table contains information needed during horizontal
37
+ text layout.
38
+
39
+ .. note::
40
+ This converter class is kept in sync with the :class:`._v_h_e_a.table__v_h_e_a`
41
+ table constructor.
42
+
43
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/hhea
44
+ """
45
+
34
46
  # Note: Keep in sync with table__v_h_e_a
35
47
 
36
48
  dependencies = ["hmtx", "glyf", "CFF ", "CFF2"]
@@ -12,6 +12,15 @@ log = logging.getLogger(__name__)
12
12
 
13
13
 
14
14
  class table__h_m_t_x(DefaultTable.DefaultTable):
15
+ """Horizontal Metrics table
16
+
17
+ The ``hmtx`` table contains per-glyph metrics for the glyphs in a
18
+ ``glyf``, ``CFF ``, or ``CFF2`` table, as needed for horizontal text
19
+ layout.
20
+
21
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/hmtx
22
+ """
23
+
15
24
  headerTag = "hhea"
16
25
  advanceName = "width"
17
26
  sideBearingName = "lsb"
@@ -12,6 +12,17 @@ log = logging.getLogger(__name__)
12
12
 
13
13
 
14
14
  class table__k_e_r_n(DefaultTable.DefaultTable):
15
+ """Kerning table
16
+
17
+ The ``kern`` table contains values that contextually adjust the inter-glyph
18
+ spacing for the glyphs in a ``glyf`` table.
19
+
20
+ Note that similar contextual spacing adjustments can also be stored
21
+ in the "kern" feature of a ``GPOS`` table.
22
+
23
+ See also https://learn.microsoft.com/en-us/typography/opentype/spec/kern
24
+ """
25
+
15
26
  def getkern(self, format):
16
27
  for subtable in self.kernTables:
17
28
  if subtable.format == format: