fonttools 4.55.2__py3-none-any.whl → 4.55.3__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.
- fontTools/__init__.py +1 -1
- fontTools/feaLib/builder.py +22 -3
- fontTools/otlLib/builder.py +17 -0
- fontTools/ttLib/tables/B_A_S_E_.py +9 -0
- fontTools/ttLib/tables/C_B_D_T_.py +10 -0
- fontTools/ttLib/tables/C_B_L_C_.py +10 -0
- fontTools/ttLib/tables/C_F_F_.py +15 -0
- fontTools/ttLib/tables/C_F_F__2.py +13 -0
- fontTools/ttLib/tables/C_O_L_R_.py +9 -1
- fontTools/ttLib/tables/C_P_A_L_.py +9 -0
- fontTools/ttLib/tables/D_S_I_G_.py +7 -0
- fontTools/ttLib/tables/E_B_D_T_.py +8 -0
- fontTools/ttLib/tables/E_B_L_C_.py +8 -0
- fontTools/ttLib/tables/F_F_T_M_.py +10 -0
- fontTools/ttLib/tables/F__e_a_t.py +7 -2
- fontTools/ttLib/tables/G_D_E_F_.py +8 -0
- fontTools/ttLib/tables/G_M_A_P_.py +7 -0
- fontTools/ttLib/tables/G_P_K_G_.py +7 -0
- fontTools/ttLib/tables/G_P_O_S_.py +9 -0
- fontTools/ttLib/tables/G_S_U_B_.py +8 -0
- fontTools/ttLib/tables/G__l_a_t.py +3 -2
- fontTools/ttLib/tables/G__l_o_c.py +3 -2
- fontTools/ttLib/tables/H_V_A_R_.py +8 -0
- fontTools/ttLib/tables/J_S_T_F_.py +8 -0
- fontTools/ttLib/tables/L_T_S_H_.py +10 -0
- fontTools/ttLib/tables/M_A_T_H_.py +8 -0
- fontTools/ttLib/tables/M_E_T_A_.py +7 -0
- fontTools/ttLib/tables/M_V_A_R_.py +8 -0
- fontTools/ttLib/tables/O_S_2f_2.py +8 -1
- fontTools/ttLib/tables/S_I_N_G_.py +7 -0
- fontTools/ttLib/tables/S_T_A_T_.py +10 -0
- fontTools/ttLib/tables/S_V_G_.py +8 -0
- fontTools/ttLib/tables/S__i_l_f.py +4 -1
- fontTools/ttLib/tables/S__i_l_l.py +5 -0
- fontTools/ttLib/tables/T_S_I_B_.py +8 -0
- fontTools/ttLib/tables/T_S_I_C_.py +9 -0
- fontTools/ttLib/tables/T_S_I_D_.py +8 -0
- fontTools/ttLib/tables/T_S_I_J_.py +8 -0
- fontTools/ttLib/tables/T_S_I_P_.py +8 -0
- fontTools/ttLib/tables/T_S_I_S_.py +8 -0
- fontTools/ttLib/tables/T_S_I_V_.py +6 -0
- fontTools/ttLib/tables/T_S_I__0.py +2 -0
- fontTools/ttLib/tables/T_S_I__1.py +2 -0
- fontTools/ttLib/tables/T_S_I__2.py +2 -0
- fontTools/ttLib/tables/T_S_I__3.py +2 -0
- fontTools/ttLib/tables/T_S_I__5.py +2 -0
- fontTools/ttLib/tables/T_T_F_A_.py +9 -0
- fontTools/ttLib/tables/V_A_R_C_.py +7 -0
- fontTools/ttLib/tables/V_D_M_X_.py +8 -0
- fontTools/ttLib/tables/V_O_R_G_.py +8 -1
- fontTools/ttLib/tables/V_V_A_R_.py +8 -0
- fontTools/ttLib/tables/_a_n_k_r.py +3 -2
- fontTools/ttLib/tables/_a_v_a_r.py +3 -1
- fontTools/ttLib/tables/_b_s_l_n.py +9 -0
- fontTools/ttLib/tables/_c_i_d_g.py +7 -2
- fontTools/ttLib/tables/_c_m_a_p.py +2 -0
- fontTools/ttLib/tables/_c_v_a_r.py +8 -0
- fontTools/ttLib/tables/_c_v_t.py +8 -0
- fontTools/ttLib/tables/_f_e_a_t.py +7 -4
- fontTools/ttLib/tables/_f_p_g_m.py +11 -0
- fontTools/ttLib/tables/_f_v_a_r.py +8 -0
- fontTools/ttLib/tables/_g_a_s_p.py +8 -0
- fontTools/ttLib/tables/_g_c_i_d.py +7 -0
- fontTools/ttLib/tables/_g_l_y_f.py +1 -1
- fontTools/ttLib/tables/_g_v_a_r.py +11 -3
- fontTools/ttLib/tables/_h_d_m_x.py +8 -0
- fontTools/ttLib/tables/_h_e_a_d.py +7 -0
- fontTools/ttLib/tables/_h_h_e_a.py +12 -0
- fontTools/ttLib/tables/_h_m_t_x.py +9 -0
- fontTools/ttLib/tables/_k_e_r_n.py +11 -0
- fontTools/ttLib/tables/_l_c_a_r.py +8 -0
- fontTools/ttLib/tables/_l_o_c_a.py +8 -0
- fontTools/ttLib/tables/_l_t_a_g.py +8 -0
- fontTools/ttLib/tables/_m_a_x_p.py +8 -0
- fontTools/ttLib/tables/_m_e_t_a.py +8 -0
- fontTools/ttLib/tables/_m_o_r_t.py +8 -0
- fontTools/ttLib/tables/_m_o_r_x.py +9 -0
- fontTools/ttLib/tables/_n_a_m_e.py +10 -0
- fontTools/ttLib/tables/_o_p_b_d.py +8 -0
- fontTools/ttLib/tables/_p_o_s_t.py +9 -0
- fontTools/ttLib/tables/_p_r_e_p.py +9 -0
- fontTools/ttLib/tables/_p_r_o_p.py +6 -0
- fontTools/ttLib/tables/_s_b_i_x.py +10 -0
- fontTools/ttLib/tables/_t_r_a_k.py +7 -0
- fontTools/ttLib/tables/_v_h_e_a.py +12 -0
- fontTools/ttLib/tables/_v_m_t_x.py +9 -0
- {fonttools-4.55.2.dist-info → fonttools-4.55.3.dist-info}/METADATA +8 -1
- {fonttools-4.55.2.dist-info → fonttools-4.55.3.dist-info}/RECORD +93 -93
- {fonttools-4.55.2.data → fonttools-4.55.3.data}/data/share/man/man1/ttx.1 +0 -0
- {fonttools-4.55.2.dist-info → fonttools-4.55.3.dist-info}/LICENSE +0 -0
- {fonttools-4.55.2.dist-info → fonttools-4.55.3.dist-info}/WHEEL +0 -0
- {fonttools-4.55.2.dist-info → fonttools-4.55.3.dist-info}/entry_points.txt +0 -0
- {fonttools-4.55.2.dist-info → fonttools-4.55.3.dist-info}/top_level.txt +0 -0
|
@@ -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,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
|
-
"""
|
|
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
|
|
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
|
|
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
|
-
"""
|
|
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):
|
fontTools/ttLib/tables/_c_v_t.py
CHANGED
|
@@ -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
|
-
"""
|
|
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.
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
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,
|
|
@@ -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:
|
|
@@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class table__l_c_a_r(BaseTTXConverter):
|
|
5
|
+
"""Ligature Caret table
|
|
6
|
+
|
|
7
|
+
The AAT ``lcar`` table stores division points within ligatures, which applications
|
|
8
|
+
can use to position carets properly between the logical parts of the ligature.
|
|
9
|
+
|
|
10
|
+
See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6lcar.html
|
|
11
|
+
"""
|
|
12
|
+
|
|
5
13
|
pass
|
|
@@ -8,6 +8,14 @@ log = logging.getLogger(__name__)
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class table__l_o_c_a(DefaultTable.DefaultTable):
|
|
11
|
+
"""Index to Location table
|
|
12
|
+
|
|
13
|
+
The ``loca`` table stores the offsets in the ``glyf`` table that correspond
|
|
14
|
+
to the descriptions of each glyph. The glyphs are references by Glyph ID.
|
|
15
|
+
|
|
16
|
+
See also https://learn.microsoft.com/en-us/typography/opentype/spec/loca
|
|
17
|
+
"""
|
|
18
|
+
|
|
11
19
|
dependencies = ["glyf"]
|
|
12
20
|
|
|
13
21
|
def decompile(self, data, ttFont):
|
|
@@ -6,6 +6,14 @@ import struct
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
class table__l_t_a_g(DefaultTable.DefaultTable):
|
|
9
|
+
"""Language Tag table
|
|
10
|
+
|
|
11
|
+
The AAT ``ltag`` table contains mappings between the numeric codes used
|
|
12
|
+
in the language field of the ``name`` table and IETF language tags.
|
|
13
|
+
|
|
14
|
+
See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ltag.html
|
|
15
|
+
"""
|
|
16
|
+
|
|
9
17
|
def __init__(self, tag=None):
|
|
10
18
|
DefaultTable.DefaultTable.__init__(self, tag)
|
|
11
19
|
self.version, self.flags = 1, 0
|
|
@@ -27,6 +27,14 @@ maxpFormat_1_0_add = """
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class table__m_a_x_p(DefaultTable.DefaultTable):
|
|
30
|
+
"""Maximum Profile table
|
|
31
|
+
|
|
32
|
+
The ``maxp`` table contains the memory requirements for the data in
|
|
33
|
+
the font.
|
|
34
|
+
|
|
35
|
+
See also https://learn.microsoft.com/en-us/typography/opentype/spec/maxp
|
|
36
|
+
"""
|
|
37
|
+
|
|
30
38
|
dependencies = ["glyf"]
|
|
31
39
|
|
|
32
40
|
def decompile(self, data, ttFont):
|
|
@@ -24,6 +24,14 @@ DATA_MAP_FORMAT = """
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class table__m_e_t_a(DefaultTable.DefaultTable):
|
|
27
|
+
"""Metadata table
|
|
28
|
+
|
|
29
|
+
The ``meta`` table contains various metadata values for the font. Each
|
|
30
|
+
category of metadata in the table is identified by a four-character tag.
|
|
31
|
+
|
|
32
|
+
See also https://learn.microsoft.com/en-us/typography/opentype/spec/meta
|
|
33
|
+
"""
|
|
34
|
+
|
|
27
35
|
def __init__(self, tag=None):
|
|
28
36
|
DefaultTable.DefaultTable.__init__(self, tag)
|
|
29
37
|
self.data = {}
|
|
@@ -3,4 +3,12 @@ from .otBase import BaseTTXConverter
|
|
|
3
3
|
|
|
4
4
|
# https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6mort.html
|
|
5
5
|
class table__m_o_r_t(BaseTTXConverter):
|
|
6
|
+
"""The AAT ``mort`` table contains glyph transformations used for script shaping and
|
|
7
|
+
for various other optional smart features.
|
|
8
|
+
|
|
9
|
+
Note: ``mort`` has been deprecated in favor of the newer ``morx`` table.
|
|
10
|
+
|
|
11
|
+
See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6mort.html
|
|
12
|
+
"""
|
|
13
|
+
|
|
6
14
|
pass
|
|
@@ -3,4 +3,13 @@ from .otBase import BaseTTXConverter
|
|
|
3
3
|
|
|
4
4
|
# https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html
|
|
5
5
|
class table__m_o_r_x(BaseTTXConverter):
|
|
6
|
+
"""The AAT ``morx`` table contains glyph transformations used for script shaping and
|
|
7
|
+
for various other optional smart features, akin to ``GSUB`` and ``GPOS`` features
|
|
8
|
+
in OpenType Layout.
|
|
9
|
+
|
|
10
|
+
Note: ``morx`` is a replacement for the now deprecated ``mort`` table.
|
|
11
|
+
|
|
12
|
+
See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html
|
|
13
|
+
"""
|
|
14
|
+
|
|
6
15
|
pass
|
|
@@ -36,6 +36,16 @@ nameRecordSize = sstruct.calcsize(nameRecordFormat)
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
class table__n_a_m_e(DefaultTable.DefaultTable):
|
|
39
|
+
"""Naming table
|
|
40
|
+
|
|
41
|
+
The ``name`` table is used to store a variety of strings that can be
|
|
42
|
+
associated with user-facing font information. Records in the ``name``
|
|
43
|
+
table can be tagged with language tags to support multilingual naming
|
|
44
|
+
and can support platform-specific character-encoding variants.
|
|
45
|
+
|
|
46
|
+
See also https://learn.microsoft.com/en-us/typography/opentype/spec/name
|
|
47
|
+
"""
|
|
48
|
+
|
|
39
49
|
dependencies = ["ltag"]
|
|
40
50
|
|
|
41
51
|
def decompile(self, data, ttFont):
|
|
@@ -3,4 +3,12 @@ from .otBase import BaseTTXConverter
|
|
|
3
3
|
|
|
4
4
|
# https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6opbd.html
|
|
5
5
|
class table__o_p_b_d(BaseTTXConverter):
|
|
6
|
+
"""Optical Bounds table
|
|
7
|
+
|
|
8
|
+
The AAT ``opbd`` table contains optical boundary points for glyphs, which
|
|
9
|
+
applications can use for the visual alignment of lines of text.
|
|
10
|
+
|
|
11
|
+
See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6opbd.html
|
|
12
|
+
"""
|
|
13
|
+
|
|
6
14
|
pass
|
|
@@ -27,6 +27,15 @@ postFormatSize = sstruct.calcsize(postFormat)
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
class table__p_o_s_t(DefaultTable.DefaultTable):
|
|
30
|
+
"""PostScript table
|
|
31
|
+
|
|
32
|
+
The ``post`` table contains information needed to use the font on
|
|
33
|
+
PostScript printers, including the PostScript names of glyphs and
|
|
34
|
+
data that was stored in the ``FontInfo`` dictionary for Type 1 fonts.
|
|
35
|
+
|
|
36
|
+
See also https://learn.microsoft.com/en-us/typography/opentype/spec/post
|
|
37
|
+
"""
|
|
38
|
+
|
|
30
39
|
def decompile(self, data, ttFont):
|
|
31
40
|
sstruct.unpack(postFormat, data[:postFormatSize], self)
|
|
32
41
|
data = data[postFormatSize:]
|
|
@@ -4,4 +4,13 @@ superclass = ttLib.getTableClass("fpgm")
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class table__p_r_e_p(superclass):
|
|
7
|
+
"""Control Value Program table
|
|
8
|
+
|
|
9
|
+
The ``prep`` table contains TrueType instructions that can makee font-wide
|
|
10
|
+
alterations to the Control Value Table. It may potentially be executed
|
|
11
|
+
before any glyph is processed.
|
|
12
|
+
|
|
13
|
+
See also https://learn.microsoft.com/en-us/typography/opentype/spec/prep
|
|
14
|
+
"""
|
|
15
|
+
|
|
7
16
|
pass
|
|
@@ -3,4 +3,10 @@ from .otBase import BaseTTXConverter
|
|
|
3
3
|
|
|
4
4
|
# https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6prop.html
|
|
5
5
|
class table__p_r_o_p(BaseTTXConverter):
|
|
6
|
+
"""The AAT ``prop`` table can store a variety of per-glyph properties, such as
|
|
7
|
+
Unicode directionality or whether glyphs are non-spacing marks.
|
|
8
|
+
|
|
9
|
+
See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6prop.html
|
|
10
|
+
"""
|
|
11
|
+
|
|
6
12
|
pass
|