From e5eb053105b4ed78f330b48f68563f923bca34d0 Mon Sep 17 00:00:00 2001 From: Nathan Williis Date: Wed, 4 Dec 2024 15:58:46 +0000 Subject: [PATCH] Docs: add boilerplate docstrings to table converters. Mostly links to reference specs. --- Lib/fontTools/ttLib/tables/B_A_S_E_.py | 9 +++++++++ Lib/fontTools/ttLib/tables/C_B_D_T_.py | 10 ++++++++++ Lib/fontTools/ttLib/tables/C_B_L_C_.py | 10 ++++++++++ Lib/fontTools/ttLib/tables/C_F_F_.py | 15 +++++++++++++++ Lib/fontTools/ttLib/tables/C_F_F__2.py | 13 +++++++++++++ Lib/fontTools/ttLib/tables/C_O_L_R_.py | 10 +++++++++- Lib/fontTools/ttLib/tables/C_P_A_L_.py | 9 +++++++++ Lib/fontTools/ttLib/tables/D_S_I_G_.py | 7 +++++++ Lib/fontTools/ttLib/tables/E_B_D_T_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/E_B_L_C_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/F_F_T_M_.py | 10 ++++++++++ Lib/fontTools/ttLib/tables/F__e_a_t.py | 9 +++++++-- Lib/fontTools/ttLib/tables/G_D_E_F_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/G_M_A_P_.py | 7 +++++++ Lib/fontTools/ttLib/tables/G_P_K_G_.py | 7 +++++++ Lib/fontTools/ttLib/tables/G_P_O_S_.py | 9 +++++++++ Lib/fontTools/ttLib/tables/G_S_U_B_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/G__l_a_t.py | 5 +++-- Lib/fontTools/ttLib/tables/G__l_o_c.py | 5 +++-- Lib/fontTools/ttLib/tables/H_V_A_R_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/J_S_T_F_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/L_T_S_H_.py | 10 ++++++++++ Lib/fontTools/ttLib/tables/M_A_T_H_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/M_E_T_A_.py | 7 +++++++ Lib/fontTools/ttLib/tables/M_V_A_R_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/O_S_2f_2.py | 9 ++++++++- Lib/fontTools/ttLib/tables/S_I_N_G_.py | 7 +++++++ Lib/fontTools/ttLib/tables/S_T_A_T_.py | 10 ++++++++++ Lib/fontTools/ttLib/tables/S_V_G_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/S__i_l_f.py | 5 ++++- Lib/fontTools/ttLib/tables/S__i_l_l.py | 5 +++++ Lib/fontTools/ttLib/tables/T_S_I_B_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/T_S_I_C_.py | 9 +++++++++ Lib/fontTools/ttLib/tables/T_S_I_D_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/T_S_I_J_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/T_S_I_P_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/T_S_I_S_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/T_S_I_V_.py | 6 ++++++ Lib/fontTools/ttLib/tables/T_S_I__0.py | 2 ++ Lib/fontTools/ttLib/tables/T_S_I__1.py | 2 ++ Lib/fontTools/ttLib/tables/T_S_I__2.py | 2 ++ Lib/fontTools/ttLib/tables/T_S_I__3.py | 2 ++ Lib/fontTools/ttLib/tables/T_S_I__5.py | 2 ++ Lib/fontTools/ttLib/tables/T_T_F_A_.py | 9 +++++++++ Lib/fontTools/ttLib/tables/V_A_R_C_.py | 7 +++++++ Lib/fontTools/ttLib/tables/V_D_M_X_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/V_O_R_G_.py | 9 ++++++++- Lib/fontTools/ttLib/tables/V_V_A_R_.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_a_n_k_r.py | 5 +++-- Lib/fontTools/ttLib/tables/_a_v_a_r.py | 4 +++- Lib/fontTools/ttLib/tables/_b_s_l_n.py | 9 +++++++++ Lib/fontTools/ttLib/tables/_c_i_d_g.py | 9 +++++++-- Lib/fontTools/ttLib/tables/_c_m_a_p.py | 2 ++ Lib/fontTools/ttLib/tables/_c_v_a_r.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_c_v_t.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_f_e_a_t.py | 11 +++++++---- Lib/fontTools/ttLib/tables/_f_p_g_m.py | 11 +++++++++++ Lib/fontTools/ttLib/tables/_f_v_a_r.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_g_a_s_p.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_g_c_i_d.py | 7 +++++++ Lib/fontTools/ttLib/tables/_g_l_y_f.py | 2 +- Lib/fontTools/ttLib/tables/_g_v_a_r.py | 10 ++++++++++ Lib/fontTools/ttLib/tables/_h_d_m_x.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_h_e_a_d.py | 7 +++++++ Lib/fontTools/ttLib/tables/_h_h_e_a.py | 12 ++++++++++++ Lib/fontTools/ttLib/tables/_h_m_t_x.py | 9 +++++++++ Lib/fontTools/ttLib/tables/_k_e_r_n.py | 11 +++++++++++ Lib/fontTools/ttLib/tables/_l_c_a_r.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_l_o_c_a.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_l_t_a_g.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_m_a_x_p.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_m_e_t_a.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_m_o_r_t.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_m_o_r_x.py | 9 +++++++++ Lib/fontTools/ttLib/tables/_n_a_m_e.py | 10 ++++++++++ Lib/fontTools/ttLib/tables/_o_p_b_d.py | 8 ++++++++ Lib/fontTools/ttLib/tables/_p_o_s_t.py | 9 +++++++++ Lib/fontTools/ttLib/tables/_p_r_e_p.py | 9 +++++++++ Lib/fontTools/ttLib/tables/_p_r_o_p.py | 6 ++++++ Lib/fontTools/ttLib/tables/_s_b_i_x.py | 10 ++++++++++ Lib/fontTools/ttLib/tables/_t_r_a_k.py | 7 +++++++ Lib/fontTools/ttLib/tables/_v_h_e_a.py | 12 ++++++++++++ Lib/fontTools/ttLib/tables/_v_m_t_x.py | 9 +++++++++ 83 files changed, 632 insertions(+), 20 deletions(-) diff --git a/Lib/fontTools/ttLib/tables/B_A_S_E_.py b/Lib/fontTools/ttLib/tables/B_A_S_E_.py index f468a963a..0f4b1c3c5 100644 --- a/Lib/fontTools/ttLib/tables/B_A_S_E_.py +++ b/Lib/fontTools/ttLib/tables/B_A_S_E_.py @@ -2,4 +2,13 @@ from .otBase import BaseTTXConverter class table_B_A_S_E_(BaseTTXConverter): + """Baseline table + + The ``BASE`` table contains information needed to align glyphs in + different scripts, from different fonts, or at different sizes + within the same line of text. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/base + """ + pass diff --git a/Lib/fontTools/ttLib/tables/C_B_D_T_.py b/Lib/fontTools/ttLib/tables/C_B_D_T_.py index 2b87ac862..0f9924745 100644 --- a/Lib/fontTools/ttLib/tables/C_B_D_T_.py +++ b/Lib/fontTools/ttLib/tables/C_B_D_T_.py @@ -21,6 +21,16 @@ import struct class table_C_B_D_T_(E_B_D_T_.table_E_B_D_T_): + """Color Bitmap Data table + + The ``CBDT`` table contains color bitmap data for glyphs. It must + be used in concert with the ``CBLC`` table. + + It is backwards-compatible with the monochrome/grayscale ``EBDT`` table. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/cbdt + """ + # Change the data locator table being referenced. locatorName = "CBLC" diff --git a/Lib/fontTools/ttLib/tables/C_B_L_C_.py b/Lib/fontTools/ttLib/tables/C_B_L_C_.py index fc3974ece..0673fb7ed 100644 --- a/Lib/fontTools/ttLib/tables/C_B_L_C_.py +++ b/Lib/fontTools/ttLib/tables/C_B_L_C_.py @@ -6,4 +6,14 @@ from . import E_B_L_C_ class table_C_B_L_C_(E_B_L_C_.table_E_B_L_C_): + """Color Bitmap Location table + + The ``CBLC`` table contains the locations of color bitmaps for glyphs. It must + be used in concert with the ``CBDT`` table. + + It is backwards-compatible with the monochrome/grayscale ``EBLC`` table. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/cblc + """ + dependencies = ["CBDT"] diff --git a/Lib/fontTools/ttLib/tables/C_F_F_.py b/Lib/fontTools/ttLib/tables/C_F_F_.py index c231599e3..3d974ced8 100644 --- a/Lib/fontTools/ttLib/tables/C_F_F_.py +++ b/Lib/fontTools/ttLib/tables/C_F_F_.py @@ -4,6 +4,21 @@ from . import DefaultTable class table_C_F_F_(DefaultTable.DefaultTable): + """Compact Font Format table (version 1) + + The ``CFF`` table embeds a CFF-formatted font. The CFF font format + predates OpenType and could be used as a standalone font file, but the + ``CFF`` table is also used to package CFF fonts into an OpenType + container. + + .. note:: + ``CFF`` has been succeeded by ``CFF2``, which eliminates much of + the redundancy incurred by embedding CFF version 1 in an OpenType + font. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/cff + """ + def __init__(self, tag=None): DefaultTable.DefaultTable.__init__(self, tag) self.cff = cffLib.CFFFontSet() diff --git a/Lib/fontTools/ttLib/tables/C_F_F__2.py b/Lib/fontTools/ttLib/tables/C_F_F__2.py index edbb0b92f..ff07682d2 100644 --- a/Lib/fontTools/ttLib/tables/C_F_F__2.py +++ b/Lib/fontTools/ttLib/tables/C_F_F__2.py @@ -3,6 +3,19 @@ from fontTools.ttLib.tables.C_F_F_ import table_C_F_F_ class table_C_F_F__2(table_C_F_F_): + """Compact Font Format version 2 table + + The ``CFF2`` table contains glyph data for a CFF2-flavored OpenType + font. + + .. note:: + ``CFF2`` is the successor to ``CFF``, and eliminates much of + the redundancy incurred by embedding CFF version 1 in an OpenType + font. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/cff2 + """ + def decompile(self, data, otFont): self.cff.decompile(BytesIO(data), otFont, isCFF2=True) assert len(self.cff) == 1, "can't deal with multi-font CFF tables." diff --git a/Lib/fontTools/ttLib/tables/C_O_L_R_.py b/Lib/fontTools/ttLib/tables/C_O_L_R_.py index df857842c..266a11c41 100644 --- a/Lib/fontTools/ttLib/tables/C_O_L_R_.py +++ b/Lib/fontTools/ttLib/tables/C_O_L_R_.py @@ -7,11 +7,19 @@ from . import DefaultTable class table_C_O_L_R_(DefaultTable.DefaultTable): - """This table is structured so that you can treat it like a dictionary keyed by glyph name. + """Color table + + The ``COLR`` table defines color presentation of outline glyphs. It must + be used in concert with the ``CPAL`` table, which contains the color + descriptors used. + + This table is structured so that you can treat it like a dictionary keyed by glyph name. ``ttFont['COLR'][]`` will return the color layers for any glyph. ``ttFont['COLR'][] = `` will set the color layers for any glyph. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/colr """ @staticmethod diff --git a/Lib/fontTools/ttLib/tables/C_P_A_L_.py b/Lib/fontTools/ttLib/tables/C_P_A_L_.py index 9fb2074af..5ec8c843c 100644 --- a/Lib/fontTools/ttLib/tables/C_P_A_L_.py +++ b/Lib/fontTools/ttLib/tables/C_P_A_L_.py @@ -11,6 +11,15 @@ import sys class table_C_P_A_L_(DefaultTable.DefaultTable): + """Color Palette table + + The ``CPAL`` table contains a set of one or more color palettes. The color + records in each palette can be referenced by the ``COLR`` table to specify + the colors used in a color glyph. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/cpal + """ + NO_NAME_ID = 0xFFFF DEFAULT_PALETTE_TYPE = 0 diff --git a/Lib/fontTools/ttLib/tables/D_S_I_G_.py b/Lib/fontTools/ttLib/tables/D_S_I_G_.py index d902a2908..f89cc29e4 100644 --- a/Lib/fontTools/ttLib/tables/D_S_I_G_.py +++ b/Lib/fontTools/ttLib/tables/D_S_I_G_.py @@ -39,6 +39,13 @@ DSIG_SignatureBlockFormat = """ class table_D_S_I_G_(DefaultTable.DefaultTable): + """Digital Signature table + + The ``DSIG`` table contains cryptographic signatures for the font. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/dsig + """ + def decompile(self, data, ttFont): dummy, newData = sstruct.unpack2(DSIG_HeaderFormat, data, self) assert self.ulVersion == 1, "DSIG ulVersion must be 1" diff --git a/Lib/fontTools/ttLib/tables/E_B_D_T_.py b/Lib/fontTools/ttLib/tables/E_B_D_T_.py index 9f7f82efd..ea23e30f8 100644 --- a/Lib/fontTools/ttLib/tables/E_B_D_T_.py +++ b/Lib/fontTools/ttLib/tables/E_B_D_T_.py @@ -38,6 +38,14 @@ ebdtComponentFormat = """ class table_E_B_D_T_(DefaultTable.DefaultTable): + """Embedded Bitmap Data table + + The ``EBDT`` table contains monochrome or grayscale bitmap data for + glyphs. It must be used in concert with the ``EBLC`` table. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/ebdt + """ + # Keep a reference to the name of the data locator table. locatorName = "EBLC" diff --git a/Lib/fontTools/ttLib/tables/E_B_L_C_.py b/Lib/fontTools/ttLib/tables/E_B_L_C_.py index 23d57964f..ff93aa8cf 100644 --- a/Lib/fontTools/ttLib/tables/E_B_L_C_.py +++ b/Lib/fontTools/ttLib/tables/E_B_L_C_.py @@ -66,6 +66,14 @@ codeOffsetPairSize = struct.calcsize(codeOffsetPairFormat) class table_E_B_L_C_(DefaultTable.DefaultTable): + """Embedded Bitmap Location table + + The ``EBLC`` table contains the locations of monochrome or grayscale + bitmaps for glyphs. It must be used in concert with the ``EBDT`` table. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/eblc + """ + dependencies = ["EBDT"] # This method can be overridden in subclasses to support new formats diff --git a/Lib/fontTools/ttLib/tables/F_F_T_M_.py b/Lib/fontTools/ttLib/tables/F_F_T_M_.py index 823ced1ba..20b723466 100644 --- a/Lib/fontTools/ttLib/tables/F_F_T_M_.py +++ b/Lib/fontTools/ttLib/tables/F_F_T_M_.py @@ -13,6 +13,16 @@ FFTMFormat = """ class table_F_F_T_M_(DefaultTable.DefaultTable): + """FontForge Time Stamp table + + The ``FFTM`` table is used by the free-software font editor + FontForge to record timestamps for the creation and modification + of font source (.sfd) files and a timestamp for FontForge's + own source code. + + See also https://fontforge.org/docs/techref/non-standard.html + """ + def decompile(self, data, ttFont): dummy, rest = sstruct.unpack2(FFTMFormat, data, self) diff --git a/Lib/fontTools/ttLib/tables/F__e_a_t.py b/Lib/fontTools/ttLib/tables/F__e_a_t.py index fbcd6ca6e..579eb27bd 100644 --- a/Lib/fontTools/ttLib/tables/F__e_a_t.py +++ b/Lib/fontTools/ttLib/tables/F__e_a_t.py @@ -12,12 +12,17 @@ Feat_hdr_format = """ class table_F__e_a_t(DefaultTable.DefaultTable): - """The ``Feat`` table is used exclusively by the Graphite shaping engine + """Feature table + + The ``Feat`` table is used exclusively by the Graphite shaping engine to store features and possible settings specified in GDL. Graphite features determine what rules are applied to transform a glyph stream. Not to be confused with ``feat``, or the OpenType Layout tables - ``GSUB``/``GPOS``.""" + ``GSUB``/``GPOS``. + + See also https://graphite.sil.org/graphite_techAbout#graphite-font-tables + """ def __init__(self, tag=None): DefaultTable.DefaultTable.__init__(self, tag) diff --git a/Lib/fontTools/ttLib/tables/G_D_E_F_.py b/Lib/fontTools/ttLib/tables/G_D_E_F_.py index d8ae8b23b..922a9cb20 100644 --- a/Lib/fontTools/ttLib/tables/G_D_E_F_.py +++ b/Lib/fontTools/ttLib/tables/G_D_E_F_.py @@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter class table_G_D_E_F_(BaseTTXConverter): + """Glyph Definition table + + The ``GDEF`` table stores various glyph properties that are used + by OpenType Layout. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/gdef + """ + pass diff --git a/Lib/fontTools/ttLib/tables/G_M_A_P_.py b/Lib/fontTools/ttLib/tables/G_M_A_P_.py index 949ef842e..070c61919 100644 --- a/Lib/fontTools/ttLib/tables/G_M_A_P_.py +++ b/Lib/fontTools/ttLib/tables/G_M_A_P_.py @@ -81,6 +81,13 @@ class GMAPRecord(object): class table_G_M_A_P_(DefaultTable.DefaultTable): + """Glyphlets GMAP table + + The ``GMAP`` table is used by Adobe's SING Glyphlets. + + See also https://web.archive.org/web/20080627183635/http://www.adobe.com/devnet/opentype/gdk/topic.html + """ + dependencies = [] def decompile(self, data, ttFont): diff --git a/Lib/fontTools/ttLib/tables/G_P_K_G_.py b/Lib/fontTools/ttLib/tables/G_P_K_G_.py index eed34d921..0da99fcda 100644 --- a/Lib/fontTools/ttLib/tables/G_P_K_G_.py +++ b/Lib/fontTools/ttLib/tables/G_P_K_G_.py @@ -16,6 +16,13 @@ GPKGFormat = """ class table_G_P_K_G_(DefaultTable.DefaultTable): + """Glyphlets GPKG table + + The ``GPKG`` table is used by Adobe's SING Glyphlets. + + See also https://web.archive.org/web/20080627183635/http://www.adobe.com/devnet/opentype/gdk/topic.html + """ + def decompile(self, data, ttFont): dummy, newData = sstruct.unpack2(GPKGFormat, data, self) diff --git a/Lib/fontTools/ttLib/tables/G_P_O_S_.py b/Lib/fontTools/ttLib/tables/G_P_O_S_.py index ca8290bab..03bdc612e 100644 --- a/Lib/fontTools/ttLib/tables/G_P_O_S_.py +++ b/Lib/fontTools/ttLib/tables/G_P_O_S_.py @@ -2,4 +2,13 @@ from .otBase import BaseTTXConverter class table_G_P_O_S_(BaseTTXConverter): + """Glyph Positioning table + + The ``GPOS`` table stores advanced glyph-positioning data + used in OpenType Layout features, such as mark attachment, + cursive attachment, kerning, and other position adjustments. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/gpos + """ + pass diff --git a/Lib/fontTools/ttLib/tables/G_S_U_B_.py b/Lib/fontTools/ttLib/tables/G_S_U_B_.py index bb8375a5f..ca1aff8b0 100644 --- a/Lib/fontTools/ttLib/tables/G_S_U_B_.py +++ b/Lib/fontTools/ttLib/tables/G_S_U_B_.py @@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter class table_G_S_U_B_(BaseTTXConverter): + """Glyph Substitution table + + The ``GSUB`` table contains glyph-substitution rules used in + OpenType Layout. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/gsub + """ + pass diff --git a/Lib/fontTools/ttLib/tables/G__l_a_t.py b/Lib/fontTools/ttLib/tables/G__l_a_t.py index f1dfdaa03..fe1e0534f 100644 --- a/Lib/fontTools/ttLib/tables/G__l_a_t.py +++ b/Lib/fontTools/ttLib/tables/G__l_a_t.py @@ -62,8 +62,9 @@ class _Dict(dict): class table_G__l_a_t(DefaultTable.DefaultTable): - """ - Support Graphite Glat tables + """Graphite Glyph Attributes table + + See also https://graphite.sil.org/graphite_techAbout#graphite-font-tables """ def __init__(self, tag=None): diff --git a/Lib/fontTools/ttLib/tables/G__l_o_c.py b/Lib/fontTools/ttLib/tables/G__l_o_c.py index 7973b9be9..4c3d78ab2 100644 --- a/Lib/fontTools/ttLib/tables/G__l_o_c.py +++ b/Lib/fontTools/ttLib/tables/G__l_o_c.py @@ -15,8 +15,9 @@ Gloc_header = """ class table_G__l_o_c(DefaultTable.DefaultTable): - """ - Support Graphite Gloc tables + """Graphite Index to Glyph Atttributes table + + See also https://graphite.sil.org/graphite_techAbout#graphite-font-tables """ dependencies = ["Glat"] diff --git a/Lib/fontTools/ttLib/tables/H_V_A_R_.py b/Lib/fontTools/ttLib/tables/H_V_A_R_.py index 094aedaea..48e7fd67c 100644 --- a/Lib/fontTools/ttLib/tables/H_V_A_R_.py +++ b/Lib/fontTools/ttLib/tables/H_V_A_R_.py @@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter class table_H_V_A_R_(BaseTTXConverter): + """Horizontal Metrics Variations table + + The ``HVAR`` table contains variations in horizontal glyph metrics + in variable fonts. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/hvar + """ + pass diff --git a/Lib/fontTools/ttLib/tables/J_S_T_F_.py b/Lib/fontTools/ttLib/tables/J_S_T_F_.py index 111c70071..b185f30f3 100644 --- a/Lib/fontTools/ttLib/tables/J_S_T_F_.py +++ b/Lib/fontTools/ttLib/tables/J_S_T_F_.py @@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter class table_J_S_T_F_(BaseTTXConverter): + """Justification table + + The ``JSTF`` table contains glyph substitution and positioning + data used to perform text justification. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/jstf + """ + pass diff --git a/Lib/fontTools/ttLib/tables/L_T_S_H_.py b/Lib/fontTools/ttLib/tables/L_T_S_H_.py index e0ab0d021..e691c06e9 100644 --- a/Lib/fontTools/ttLib/tables/L_T_S_H_.py +++ b/Lib/fontTools/ttLib/tables/L_T_S_H_.py @@ -9,6 +9,16 @@ import array class table_L_T_S_H_(DefaultTable.DefaultTable): + """Linear Threshold table + + The ``LTSH`` table contains per-glyph settings indicating the ppem sizes + at which the advance width metric should be scaled linearly, despite the + effects of any TrueType instructions that might otherwise alter the + advance width. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/ltsh + """ + def decompile(self, data, ttFont): version, numGlyphs = struct.unpack(">HH", data[:4]) data = data[4:] diff --git a/Lib/fontTools/ttLib/tables/M_A_T_H_.py b/Lib/fontTools/ttLib/tables/M_A_T_H_.py index 011426b52..35d29e9b1 100644 --- a/Lib/fontTools/ttLib/tables/M_A_T_H_.py +++ b/Lib/fontTools/ttLib/tables/M_A_T_H_.py @@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter class table_M_A_T_H_(BaseTTXConverter): + """Mathematical Typesetting table + + The ``MATH`` table contains a variety of information needed to + typeset glyphs in mathematical formulas and expressions. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/math + """ + pass diff --git a/Lib/fontTools/ttLib/tables/M_E_T_A_.py b/Lib/fontTools/ttLib/tables/M_E_T_A_.py index 445aeb4de..6a6f8bbf8 100644 --- a/Lib/fontTools/ttLib/tables/M_E_T_A_.py +++ b/Lib/fontTools/ttLib/tables/M_E_T_A_.py @@ -68,6 +68,13 @@ def getLabelString(labelID): class table_M_E_T_A_(DefaultTable.DefaultTable): + """Glyphlets META table + + The ``META`` table is used by Adobe's SING Glyphlets. + + See also https://web.archive.org/web/20080627183635/http://www.adobe.com/devnet/opentype/gdk/topic.html + """ + dependencies = [] def decompile(self, data, ttFont): diff --git a/Lib/fontTools/ttLib/tables/M_V_A_R_.py b/Lib/fontTools/ttLib/tables/M_V_A_R_.py index 8371795eb..c7e7e90fb 100644 --- a/Lib/fontTools/ttLib/tables/M_V_A_R_.py +++ b/Lib/fontTools/ttLib/tables/M_V_A_R_.py @@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter class table_M_V_A_R_(BaseTTXConverter): + """Metrics Variations table + + The ``MVAR`` table contains variation information for font-wide + metrics in a variable font. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/mvar + """ + pass diff --git a/Lib/fontTools/ttLib/tables/O_S_2f_2.py b/Lib/fontTools/ttLib/tables/O_S_2f_2.py index 0c739bcc4..9a7e5f70b 100644 --- a/Lib/fontTools/ttLib/tables/O_S_2f_2.py +++ b/Lib/fontTools/ttLib/tables/O_S_2f_2.py @@ -113,7 +113,14 @@ OS2_format_5_addition = bigendian + OS2_format_5_addition class table_O_S_2f_2(DefaultTable.DefaultTable): - """the OS/2 table""" + """OS/2 and Windows Metrics table + + The ``OS/2`` table contains a variety of font-wide metrics and + parameters that may be useful to an operating system or other + software for system-integration purposes. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/os2 + """ dependencies = ["head"] diff --git a/Lib/fontTools/ttLib/tables/S_I_N_G_.py b/Lib/fontTools/ttLib/tables/S_I_N_G_.py index 4522c06c6..1a367a92f 100644 --- a/Lib/fontTools/ttLib/tables/S_I_N_G_.py +++ b/Lib/fontTools/ttLib/tables/S_I_N_G_.py @@ -20,6 +20,13 @@ SINGFormat = """ class table_S_I_N_G_(DefaultTable.DefaultTable): + """Glyphlets SING table + + The ``SING`` table is used by Adobe's SING Glyphlets. + + See also https://web.archive.org/web/20080627183635/http://www.adobe.com/devnet/opentype/gdk/topic.html + """ + dependencies = [] def decompile(self, data, ttFont): diff --git a/Lib/fontTools/ttLib/tables/S_T_A_T_.py b/Lib/fontTools/ttLib/tables/S_T_A_T_.py index 1769de91b..86e1271a9 100644 --- a/Lib/fontTools/ttLib/tables/S_T_A_T_.py +++ b/Lib/fontTools/ttLib/tables/S_T_A_T_.py @@ -2,4 +2,14 @@ from .otBase import BaseTTXConverter class table_S_T_A_T_(BaseTTXConverter): + """Style Attributes table + + The ``STAT`` table records stylistic or typeface-design attributes that + differentiate the individual fonts within a font family from one another. + Those attributes can be used to assist users when navigating the style + variations of a variable font or a family of static fonts. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/stat + """ + pass diff --git a/Lib/fontTools/ttLib/tables/S_V_G_.py b/Lib/fontTools/ttLib/tables/S_V_G_.py index ebc2befdf..76e860c5f 100644 --- a/Lib/fontTools/ttLib/tables/S_V_G_.py +++ b/Lib/fontTools/ttLib/tables/S_V_G_.py @@ -51,6 +51,14 @@ doc_index_entry_format_0Size = sstruct.calcsize(doc_index_entry_format_0) class table_S_V_G_(DefaultTable.DefaultTable): + """Scalable Vector Graphics table + + The ``SVG`` table contains representations for glyphs in the SVG + image format. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/stat + """ + def decompile(self, data, ttFont): self.docList = [] # Version 0 is the standardized version of the table; and current. diff --git a/Lib/fontTools/ttLib/tables/S__i_l_f.py b/Lib/fontTools/ttLib/tables/S__i_l_f.py index 324ffd016..876fef3cb 100644 --- a/Lib/fontTools/ttLib/tables/S__i_l_f.py +++ b/Lib/fontTools/ttLib/tables/S__i_l_f.py @@ -343,7 +343,10 @@ class _Object: class table_S__i_l_f(DefaultTable.DefaultTable): - """Silf table support""" + """Graphite Rules table + + See also https://graphite.sil.org/graphite_techAbout#graphite-font-tables + """ def __init__(self, tag=None): DefaultTable.DefaultTable.__init__(self, tag) diff --git a/Lib/fontTools/ttLib/tables/S__i_l_l.py b/Lib/fontTools/ttLib/tables/S__i_l_l.py index 12b0b8f6c..61106ea52 100644 --- a/Lib/fontTools/ttLib/tables/S__i_l_l.py +++ b/Lib/fontTools/ttLib/tables/S__i_l_l.py @@ -12,6 +12,11 @@ Sill_hdr = """ class table_S__i_l_l(DefaultTable.DefaultTable): + """Graphite Languages table + + See also https://graphite.sil.org/graphite_techAbout#graphite-font-tables + """ + def __init__(self, tag=None): DefaultTable.DefaultTable.__init__(self, tag) self.langs = {} diff --git a/Lib/fontTools/ttLib/tables/T_S_I_B_.py b/Lib/fontTools/ttLib/tables/T_S_I_B_.py index 8a6c14c44..ea19fcee8 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I_B_.py +++ b/Lib/fontTools/ttLib/tables/T_S_I_B_.py @@ -1,3 +1,11 @@ +""" TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT) +tool to store its table source data. + +TSIB contains the source text for the ``BASE`` table. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables +""" + from .T_S_I_V_ import table_T_S_I_V_ diff --git a/Lib/fontTools/ttLib/tables/T_S_I_C_.py b/Lib/fontTools/ttLib/tables/T_S_I_C_.py index 573b3f9c3..14e353cde 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I_C_.py +++ b/Lib/fontTools/ttLib/tables/T_S_I_C_.py @@ -1,3 +1,12 @@ +""" TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT) +tool to store its table source data. + +TSIC contains the source text for the Variation CVT window and data for +the ``cvar`` table. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables +""" + from .otBase import BaseTTXConverter diff --git a/Lib/fontTools/ttLib/tables/T_S_I_D_.py b/Lib/fontTools/ttLib/tables/T_S_I_D_.py index 536ff2f98..2bb9455ef 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I_D_.py +++ b/Lib/fontTools/ttLib/tables/T_S_I_D_.py @@ -1,3 +1,11 @@ +""" TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT) +tool to store its table source data. + +TSID contains the source text for the ``GDEF`` table. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables +""" + from .T_S_I_V_ import table_T_S_I_V_ diff --git a/Lib/fontTools/ttLib/tables/T_S_I_J_.py b/Lib/fontTools/ttLib/tables/T_S_I_J_.py index bc8fe92aa..379b949c6 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I_J_.py +++ b/Lib/fontTools/ttLib/tables/T_S_I_J_.py @@ -1,3 +1,11 @@ +""" TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT) +tool to store its table source data. + +TSIJ contains the source text for the ``JSTF`` table. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables +""" + from .T_S_I_V_ import table_T_S_I_V_ diff --git a/Lib/fontTools/ttLib/tables/T_S_I_P_.py b/Lib/fontTools/ttLib/tables/T_S_I_P_.py index 1abc02590..8b1786970 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I_P_.py +++ b/Lib/fontTools/ttLib/tables/T_S_I_P_.py @@ -1,3 +1,11 @@ +""" TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT) +tool to store its table source data. + +TSIP contains the source text for the ``GPOS`` table. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables +""" + from .T_S_I_V_ import table_T_S_I_V_ diff --git a/Lib/fontTools/ttLib/tables/T_S_I_S_.py b/Lib/fontTools/ttLib/tables/T_S_I_S_.py index 667eb0e53..91f36e7c0 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I_S_.py +++ b/Lib/fontTools/ttLib/tables/T_S_I_S_.py @@ -1,3 +1,11 @@ +""" TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT) +tool to store its table source data. + +TSIS contains the source text for the ``GSUB`` table. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables +""" + from .T_S_I_V_ import table_T_S_I_V_ diff --git a/Lib/fontTools/ttLib/tables/T_S_I_V_.py b/Lib/fontTools/ttLib/tables/T_S_I_V_.py index d7aec4589..32af783f2 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I_V_.py +++ b/Lib/fontTools/ttLib/tables/T_S_I_V_.py @@ -1,3 +1,9 @@ +""" TSI{B,C,D,J,P,S,V} are private tables used by Microsoft Visual TrueType (VTT) +tool to store its table source data. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables +""" + from fontTools.misc.textTools import strjoin, tobytes, tostr from . import asciiTable diff --git a/Lib/fontTools/ttLib/tables/T_S_I__0.py b/Lib/fontTools/ttLib/tables/T_S_I__0.py index 77905822a..0d0e61a1c 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I__0.py +++ b/Lib/fontTools/ttLib/tables/T_S_I__0.py @@ -4,6 +4,8 @@ tool to store its hinting source data. TSI0 is the index table containing the lengths and offsets for the glyph programs and 'extra' programs ('fpgm', 'prep', and 'cvt') that are contained in the TSI1 table. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables """ from . import DefaultTable diff --git a/Lib/fontTools/ttLib/tables/T_S_I__1.py b/Lib/fontTools/ttLib/tables/T_S_I__1.py index a9d04a09b..b0b851cc7 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I__1.py +++ b/Lib/fontTools/ttLib/tables/T_S_I__1.py @@ -3,6 +3,8 @@ tool to store its hinting source data. TSI1 contains the text of the glyph programs in the form of low-level assembly code, as well as the 'extra' programs 'fpgm', 'ppgm' (i.e. 'prep'), and 'cvt'. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables """ from . import DefaultTable diff --git a/Lib/fontTools/ttLib/tables/T_S_I__2.py b/Lib/fontTools/ttLib/tables/T_S_I__2.py index 163ef4522..63608c604 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I__2.py +++ b/Lib/fontTools/ttLib/tables/T_S_I__2.py @@ -4,6 +4,8 @@ tool to store its hinting source data. TSI2 is the index table containing the lengths and offsets for the glyph programs that are contained in the TSI3 table. It uses the same format as the TSI0 table. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables """ from fontTools import ttLib diff --git a/Lib/fontTools/ttLib/tables/T_S_I__3.py b/Lib/fontTools/ttLib/tables/T_S_I__3.py index 604a7f0be..e866826db 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I__3.py +++ b/Lib/fontTools/ttLib/tables/T_S_I__3.py @@ -2,6 +2,8 @@ tool to store its hinting source data. TSI3 contains the text of the glyph programs in the form of 'VTTTalk' code. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables """ from fontTools import ttLib diff --git a/Lib/fontTools/ttLib/tables/T_S_I__5.py b/Lib/fontTools/ttLib/tables/T_S_I__5.py index d86798695..24078b225 100644 --- a/Lib/fontTools/ttLib/tables/T_S_I__5.py +++ b/Lib/fontTools/ttLib/tables/T_S_I__5.py @@ -2,6 +2,8 @@ tool to store its hinting source data. TSI5 contains the VTT character groups. + +See also https://learn.microsoft.com/en-us/typography/tools/vtt/tsi-tables """ from fontTools.misc.textTools import safeEval diff --git a/Lib/fontTools/ttLib/tables/T_T_F_A_.py b/Lib/fontTools/ttLib/tables/T_T_F_A_.py index e3cf2db2d..4b6b06871 100644 --- a/Lib/fontTools/ttLib/tables/T_T_F_A_.py +++ b/Lib/fontTools/ttLib/tables/T_T_F_A_.py @@ -2,4 +2,13 @@ from . import asciiTable class table_T_T_F_A_(asciiTable.asciiTable): + """ttfautohint parameters table + + The ``TTFA`` table is used by the free-software `ttfautohint` program + to record the parameters that `ttfautohint` was called with when it + was used to auto-hint the font. + + See also http://freetype.org/ttfautohint/doc/ttfautohint.html#miscellaneous-1 + """ + pass diff --git a/Lib/fontTools/ttLib/tables/V_A_R_C_.py b/Lib/fontTools/ttLib/tables/V_A_R_C_.py index 5a0088716..afc1497d1 100644 --- a/Lib/fontTools/ttLib/tables/V_A_R_C_.py +++ b/Lib/fontTools/ttLib/tables/V_A_R_C_.py @@ -2,4 +2,11 @@ from .otBase import BaseTTXConverter class table_V_A_R_C_(BaseTTXConverter): + """Variable Components table + + The ``VARC`` table contains variation information for composite glyphs. + + See also https://github.com/harfbuzz/boring-expansion-spec/blob/main/VARC.md + """ + pass diff --git a/Lib/fontTools/ttLib/tables/V_D_M_X_.py b/Lib/fontTools/ttLib/tables/V_D_M_X_.py index 0632173cd..6f8abc46d 100644 --- a/Lib/fontTools/ttLib/tables/V_D_M_X_.py +++ b/Lib/fontTools/ttLib/tables/V_D_M_X_.py @@ -37,6 +37,14 @@ VDMX_vTableFmt = """ class table_V_D_M_X_(DefaultTable.DefaultTable): + """Vertical Device Metrics table + + The ``VDMX`` table records changes to the vertical glyph minima + and maxima that result from Truetype instructions. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/vdmx + """ + def decompile(self, data, ttFont): pos = 0 # track current position from to start of VDMX table dummy, data = sstruct.unpack2(VDMX_HeaderFmt, data, self) diff --git a/Lib/fontTools/ttLib/tables/V_O_R_G_.py b/Lib/fontTools/ttLib/tables/V_O_R_G_.py index b08737b22..2c53acba4 100644 --- a/Lib/fontTools/ttLib/tables/V_O_R_G_.py +++ b/Lib/fontTools/ttLib/tables/V_O_R_G_.py @@ -4,11 +4,18 @@ import struct class table_V_O_R_G_(DefaultTable.DefaultTable): - """This table is structured so that you can treat it like a dictionary keyed by glyph name. + """Vertical Origin table + + The ``VORG`` table contains the vertical origin of each glyph + in a `CFF` or `CFF2` font. + + This table is structured so that you can treat it like a dictionary keyed by glyph name. ``ttFont['VORG'][]`` will return the vertical origin for any glyph. ``ttFont['VORG'][] = `` will set the vertical origin for any glyph. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/vorg """ def decompile(self, data, ttFont): diff --git a/Lib/fontTools/ttLib/tables/V_V_A_R_.py b/Lib/fontTools/ttLib/tables/V_V_A_R_.py index a3665fea5..c0c94e348 100644 --- a/Lib/fontTools/ttLib/tables/V_V_A_R_.py +++ b/Lib/fontTools/ttLib/tables/V_V_A_R_.py @@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter class table_V_V_A_R_(BaseTTXConverter): + """Vertical Metrics Variations table + + The ``VVAR`` table contains variation data for per-glyph vertical metrics + in a variable font. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/vvar + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_a_n_k_r.py b/Lib/fontTools/ttLib/tables/_a_n_k_r.py index d1062ecc7..5466d42d4 100644 --- a/Lib/fontTools/ttLib/tables/_a_n_k_r.py +++ b/Lib/fontTools/ttLib/tables/_a_n_k_r.py @@ -2,11 +2,12 @@ from .otBase import BaseTTXConverter class table__a_n_k_r(BaseTTXConverter): - """ + """Anchor Point table + The anchor point table provides a way to define anchor points. These are points within the coordinate space of a given glyph, independent of the control points used to render the glyph. - Anchor points are used in conjunction with the 'kerx' table. + Anchor points are used in conjunction with the ``kerx`` table. See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ankr.html """ diff --git a/Lib/fontTools/ttLib/tables/_a_v_a_r.py b/Lib/fontTools/ttLib/tables/_a_v_a_r.py index 19f4f2cda..8b96bcef3 100644 --- a/Lib/fontTools/ttLib/tables/_a_v_a_r.py +++ b/Lib/fontTools/ttLib/tables/_a_v_a_r.py @@ -22,7 +22,7 @@ from .otBase import BaseTTXConverter class table__a_v_a_r(BaseTTXConverter): - """Axis Variations Table + """Axis Variations table This class represents the ``avar`` table of a variable font. The object has one substantive attribute, ``segments``, which maps axis tags to a segments dictionary:: @@ -43,6 +43,8 @@ class table__a_v_a_r(BaseTTXConverter): ``avar`` segment mapping must contain the entries ``-1.0: -1.0, 0.0: 0.0, 1.0: 1.0``. fontTools does not enforce this, so it is your responsibility to ensure that mappings are valid. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/avar """ dependencies = ["fvar"] diff --git a/Lib/fontTools/ttLib/tables/_b_s_l_n.py b/Lib/fontTools/ttLib/tables/_b_s_l_n.py index 8e266fa54..85796b0a0 100644 --- a/Lib/fontTools/ttLib/tables/_b_s_l_n.py +++ b/Lib/fontTools/ttLib/tables/_b_s_l_n.py @@ -3,4 +3,13 @@ from .otBase import BaseTTXConverter # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bsln.html class table__b_s_l_n(BaseTTXConverter): + """Baseline table + + The AAT ``bsln`` table is similar in purpose to the OpenType ``BASE`` + table; it stores per-script baselines to support automatic alignment + of lines of text. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bsln.html + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_c_i_d_g.py b/Lib/fontTools/ttLib/tables/_c_i_d_g.py index f11901bae..c283e5a4d 100644 --- a/Lib/fontTools/ttLib/tables/_c_i_d_g.py +++ b/Lib/fontTools/ttLib/tables/_c_i_d_g.py @@ -3,7 +3,9 @@ from .otBase import BaseTTXConverter class table__c_i_d_g(BaseTTXConverter): - """The AAT ``cidg`` table has almost the same structure as ``gidc``, + """CID to Glyph ID table + + The AAT ``cidg`` table has almost the same structure as ``gidc``, just mapping CIDs to GlyphIDs instead of the reverse direction. 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): obsoleted by ``cidg``. For example, the first font in ``/System/Library/Fonts/PingFang.ttc`` - (which Apple ships pre-installed on MacOS 10.12.6) has a ``cidg`` table.""" + (which Apple ships pre-installed on MacOS 10.12.6) has a ``cidg`` table. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gcid.html + """ pass diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py index 484c331cb..04be28485 100644 --- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py +++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py @@ -54,6 +54,8 @@ class table__c_m_a_p(DefaultTable.DefaultTable): cmap = newTable("cmap") cmap.tableVersion = 0 cmap.tables = [cmap4_0_3] + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/cmap """ def getcmap(self, platformID, platEncID): diff --git a/Lib/fontTools/ttLib/tables/_c_v_a_r.py b/Lib/fontTools/ttLib/tables/_c_v_a_r.py index 6ea44dbab..872710c8f 100644 --- a/Lib/fontTools/ttLib/tables/_c_v_a_r.py +++ b/Lib/fontTools/ttLib/tables/_c_v_a_r.py @@ -24,6 +24,14 @@ CVAR_HEADER_SIZE = sstruct.calcsize(CVAR_HEADER_FORMAT) class table__c_v_a_r(DefaultTable.DefaultTable): + """Control Value Table (CVT) variations table + + The ``cvar`` table contains variations for the values in a ``cvt`` + table. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/cvar + """ + dependencies = ["cvt ", "fvar"] def __init__(self, tag=None): diff --git a/Lib/fontTools/ttLib/tables/_c_v_t.py b/Lib/fontTools/ttLib/tables/_c_v_t.py index 7f9467752..92c50a1b8 100644 --- a/Lib/fontTools/ttLib/tables/_c_v_t.py +++ b/Lib/fontTools/ttLib/tables/_c_v_t.py @@ -5,6 +5,14 @@ import array class table__c_v_t(DefaultTable.DefaultTable): + """Control Value Table + + The Control Value Table holds a list of values that can be referenced + by TrueType font instructions. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/cvt + """ + def decompile(self, data, ttFont): values = array.array("h") values.frombytes(data) diff --git a/Lib/fontTools/ttLib/tables/_f_e_a_t.py b/Lib/fontTools/ttLib/tables/_f_e_a_t.py index c9a48eff0..8e279db00 100644 --- a/Lib/fontTools/ttLib/tables/_f_e_a_t.py +++ b/Lib/fontTools/ttLib/tables/_f_e_a_t.py @@ -2,11 +2,14 @@ from .otBase import BaseTTXConverter class table__f_e_a_t(BaseTTXConverter): - """The feature name table is an AAT (Apple Advanced Typography) table for + """Feature name table + + The feature name table is an AAT (Apple Advanced Typography) table for storing font features, settings, and their human-readable names. It should not be confused with the ``Feat`` table or the OpenType Layout ``GSUB``/``GPOS`` - tables. See `Feature Name Table `_ - in the TrueType Reference Manual for more information on the structure and - purpose of this table.""" + tables. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6feat.html + """ pass diff --git a/Lib/fontTools/ttLib/tables/_f_p_g_m.py b/Lib/fontTools/ttLib/tables/_f_p_g_m.py index df23041d6..ba8e0488d 100644 --- a/Lib/fontTools/ttLib/tables/_f_p_g_m.py +++ b/Lib/fontTools/ttLib/tables/_f_p_g_m.py @@ -3,6 +3,17 @@ from . import ttProgram class table__f_p_g_m(DefaultTable.DefaultTable): + """Font Program table + + The ``fpgm`` table typically contains function defintions that are + used by font instructions. This Font Program is similar to the Control + Value Program that is stored in the ``prep`` table, but + the ``fpgm`` table is only executed one time, when the font is first + used. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/fpgm + """ + def decompile(self, data, ttFont): program = ttProgram.Program() program.fromBytecode(data) diff --git a/Lib/fontTools/ttLib/tables/_f_v_a_r.py b/Lib/fontTools/ttLib/tables/_f_v_a_r.py index a3bdacd4c..f2536cb28 100644 --- a/Lib/fontTools/ttLib/tables/_f_v_a_r.py +++ b/Lib/fontTools/ttLib/tables/_f_v_a_r.py @@ -43,6 +43,14 @@ FVAR_INSTANCE_FORMAT = """ class table__f_v_a_r(DefaultTable.DefaultTable): + """FonT Variations table + + The ``fvar`` table contains records of the variation axes and of the + named instances in a variable font. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6fvar.html + """ + dependencies = ["name"] def __init__(self, tag=None): diff --git a/Lib/fontTools/ttLib/tables/_g_a_s_p.py b/Lib/fontTools/ttLib/tables/_g_a_s_p.py index 10c32a87f..1f605771e 100644 --- a/Lib/fontTools/ttLib/tables/_g_a_s_p.py +++ b/Lib/fontTools/ttLib/tables/_g_a_s_p.py @@ -10,6 +10,14 @@ GASP_GRIDFIT = 0x0001 class table__g_a_s_p(DefaultTable.DefaultTable): + """Grid-fitting and Scan-conversion Procedure table + + The ``gasp`` table defines the preferred rasterization settings for + the font when rendered on monochrome and greyscale output devices. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/gasp + """ + def decompile(self, data, ttFont): self.version, numRanges = struct.unpack(">HH", data[:4]) assert 0 <= self.version <= 1, "unknown 'gasp' format: %s" % self.version diff --git a/Lib/fontTools/ttLib/tables/_g_c_i_d.py b/Lib/fontTools/ttLib/tables/_g_c_i_d.py index 2e746c846..f2c61ae3c 100644 --- a/Lib/fontTools/ttLib/tables/_g_c_i_d.py +++ b/Lib/fontTools/ttLib/tables/_g_c_i_d.py @@ -3,4 +3,11 @@ from .otBase import BaseTTXConverter # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gcid.html class table__g_c_i_d(BaseTTXConverter): + """Glyph ID to CID table + + The AAT ``gcid` table stores glyphID-to-CID mappings. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6gcid.html + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_g_l_y_f.py b/Lib/fontTools/ttLib/tables/_g_l_y_f.py index bc7d4bf1e..92b69e70b 100644 --- a/Lib/fontTools/ttLib/tables/_g_l_y_f.py +++ b/Lib/fontTools/ttLib/tables/_g_l_y_f.py @@ -54,7 +54,7 @@ SCALE_COMPONENT_OFFSET_DEFAULT = 0 # 0 == MS, 1 == Apple class table__g_l_y_f(DefaultTable.DefaultTable): - """Glyph Data Table + """Glyph Data table This class represents the `glyf `_ table, which contains outlines for glyphs in TrueType format. In many cases, diff --git a/Lib/fontTools/ttLib/tables/_g_v_a_r.py b/Lib/fontTools/ttLib/tables/_g_v_a_r.py index cdc9ef8e7..67b634cac 100644 --- a/Lib/fontTools/ttLib/tables/_g_v_a_r.py +++ b/Lib/fontTools/ttLib/tables/_g_v_a_r.py @@ -41,6 +41,16 @@ GVAR_HEADER_SIZE = sstruct.calcsize(GVAR_HEADER_FORMAT) class table__g_v_a_r(DefaultTable.DefaultTable): + """Glyph Variations table + + The ``gvar`` table provides the per-glyph variation data that + describe how glyph outlines in the ``glyf`` table change across + the variation space that is defined for the font in the ``fvar`` + table. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/gvar + """ + dependencies = ["fvar", "glyf"] def __init__(self, tag=None): diff --git a/Lib/fontTools/ttLib/tables/_h_d_m_x.py b/Lib/fontTools/ttLib/tables/_h_d_m_x.py index b6d56a7e7..1ec913de1 100644 --- a/Lib/fontTools/ttLib/tables/_h_d_m_x.py +++ b/Lib/fontTools/ttLib/tables/_h_d_m_x.py @@ -31,6 +31,14 @@ class _GlyphnamedList(Mapping): class table__h_d_m_x(DefaultTable.DefaultTable): + """Horizontal Device Metrics table + + The ``hdmx`` table is an optional table that stores advance widths for + glyph outlines at specified pixel sizes. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/hdmx + """ + def decompile(self, data, ttFont): numGlyphs = ttFont["maxp"].numGlyphs glyphOrder = ttFont.getGlyphOrder() diff --git a/Lib/fontTools/ttLib/tables/_h_e_a_d.py b/Lib/fontTools/ttLib/tables/_h_e_a_d.py index fe29c8fc4..dcadf68a2 100644 --- a/Lib/fontTools/ttLib/tables/_h_e_a_d.py +++ b/Lib/fontTools/ttLib/tables/_h_e_a_d.py @@ -37,6 +37,13 @@ headFormat = """ class table__h_e_a_d(DefaultTable.DefaultTable): + """Font Header table + + The ``head`` table contains a variety of font-wide information. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/head + """ + dependencies = ["maxp", "loca", "CFF ", "CFF2"] def decompile(self, data, ttFont): diff --git a/Lib/fontTools/ttLib/tables/_h_h_e_a.py b/Lib/fontTools/ttLib/tables/_h_h_e_a.py index 43e464f74..1f051e499 100644 --- a/Lib/fontTools/ttLib/tables/_h_h_e_a.py +++ b/Lib/fontTools/ttLib/tables/_h_h_e_a.py @@ -31,6 +31,18 @@ hheaFormat = """ class table__h_h_e_a(DefaultTable.DefaultTable): + """Horizontal Header table + + The ``hhea`` table contains information needed during horizontal + text layout. + + .. note:: + This converter class is kept in sync with the :class:`._v_h_e_a.table__v_h_e_a` + table constructor. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/hhea + """ + # Note: Keep in sync with table__v_h_e_a dependencies = ["hmtx", "glyf", "CFF ", "CFF2"] diff --git a/Lib/fontTools/ttLib/tables/_h_m_t_x.py b/Lib/fontTools/ttLib/tables/_h_m_t_x.py index 2dbdd7f98..43d49b092 100644 --- a/Lib/fontTools/ttLib/tables/_h_m_t_x.py +++ b/Lib/fontTools/ttLib/tables/_h_m_t_x.py @@ -12,6 +12,15 @@ log = logging.getLogger(__name__) class table__h_m_t_x(DefaultTable.DefaultTable): + """Horizontal Metrics table + + The ``hmtx`` table contains per-glyph metrics for the glyphs in a + ``glyf``, ``CFF ``, or ``CFF2`` table, as needed for horizontal text + layout. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/hmtx + """ + headerTag = "hhea" advanceName = "width" sideBearingName = "lsb" diff --git a/Lib/fontTools/ttLib/tables/_k_e_r_n.py b/Lib/fontTools/ttLib/tables/_k_e_r_n.py index 270b3b7e4..cdbaebedc 100644 --- a/Lib/fontTools/ttLib/tables/_k_e_r_n.py +++ b/Lib/fontTools/ttLib/tables/_k_e_r_n.py @@ -12,6 +12,17 @@ log = logging.getLogger(__name__) class table__k_e_r_n(DefaultTable.DefaultTable): + """Kerning table + + The ``kern`` table contains values that contextually adjust the inter-glyph + spacing for the glyphs in a ``glyf`` table. + + Note that similar contextual spacing adjustments can also be stored + in the "kern" feature of a ``GPOS`` table. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/kern + """ + def getkern(self, format): for subtable in self.kernTables: if subtable.format == format: diff --git a/Lib/fontTools/ttLib/tables/_l_c_a_r.py b/Lib/fontTools/ttLib/tables/_l_c_a_r.py index 1323b670d..bbb32d23d 100644 --- a/Lib/fontTools/ttLib/tables/_l_c_a_r.py +++ b/Lib/fontTools/ttLib/tables/_l_c_a_r.py @@ -2,4 +2,12 @@ from .otBase import BaseTTXConverter class table__l_c_a_r(BaseTTXConverter): + """Ligature Caret table + + The AAT ``lcar`` table stores division points within ligatures, which applications + can use to position carets properly between the logical parts of the ligature. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6lcar.html + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_l_o_c_a.py b/Lib/fontTools/ttLib/tables/_l_o_c_a.py index 39c0c9e39..713a6eaff 100644 --- a/Lib/fontTools/ttLib/tables/_l_o_c_a.py +++ b/Lib/fontTools/ttLib/tables/_l_o_c_a.py @@ -8,6 +8,14 @@ log = logging.getLogger(__name__) class table__l_o_c_a(DefaultTable.DefaultTable): + """Index to Location table + + The ``loca`` table stores the offsets in the ``glyf`` table that correspond + to the descriptions of each glyph. The glyphs are references by Glyph ID. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/loca + """ + dependencies = ["glyf"] def decompile(self, data, ttFont): diff --git a/Lib/fontTools/ttLib/tables/_l_t_a_g.py b/Lib/fontTools/ttLib/tables/_l_t_a_g.py index 24f5e131f..fc47cd648 100644 --- a/Lib/fontTools/ttLib/tables/_l_t_a_g.py +++ b/Lib/fontTools/ttLib/tables/_l_t_a_g.py @@ -6,6 +6,14 @@ import struct class table__l_t_a_g(DefaultTable.DefaultTable): + """Language Tag table + + The AAT ``ltag`` table contains mappings between the numeric codes used + in the language field of the ``name`` table and IETF language tags. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6ltag.html + """ + def __init__(self, tag=None): DefaultTable.DefaultTable.__init__(self, tag) self.version, self.flags = 1, 0 diff --git a/Lib/fontTools/ttLib/tables/_m_a_x_p.py b/Lib/fontTools/ttLib/tables/_m_a_x_p.py index 95b6ab933..c1576a578 100644 --- a/Lib/fontTools/ttLib/tables/_m_a_x_p.py +++ b/Lib/fontTools/ttLib/tables/_m_a_x_p.py @@ -27,6 +27,14 @@ maxpFormat_1_0_add = """ class table__m_a_x_p(DefaultTable.DefaultTable): + """Maximum Profile table + + The ``maxp`` table contains the memory requirements for the data in + the font. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/maxp + """ + dependencies = ["glyf"] def decompile(self, data, ttFont): diff --git a/Lib/fontTools/ttLib/tables/_m_e_t_a.py b/Lib/fontTools/ttLib/tables/_m_e_t_a.py index 3af9e5430..c5cea1b99 100644 --- a/Lib/fontTools/ttLib/tables/_m_e_t_a.py +++ b/Lib/fontTools/ttLib/tables/_m_e_t_a.py @@ -24,6 +24,14 @@ DATA_MAP_FORMAT = """ class table__m_e_t_a(DefaultTable.DefaultTable): + """Metadata table + + The ``meta`` table contains various metadata values for the font. Each + category of metadata in the table is identified by a four-character tag. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/meta + """ + def __init__(self, tag=None): DefaultTable.DefaultTable.__init__(self, tag) self.data = {} diff --git a/Lib/fontTools/ttLib/tables/_m_o_r_t.py b/Lib/fontTools/ttLib/tables/_m_o_r_t.py index 261e593e2..5e5fa77ce 100644 --- a/Lib/fontTools/ttLib/tables/_m_o_r_t.py +++ b/Lib/fontTools/ttLib/tables/_m_o_r_t.py @@ -3,4 +3,12 @@ from .otBase import BaseTTXConverter # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6mort.html class table__m_o_r_t(BaseTTXConverter): + """The AAT ``mort`` table contains glyph transformations used for script shaping and + for various other optional smart features. + + Note: ``mort`` has been deprecated in favor of the newer ``morx`` table. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6mort.html + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_m_o_r_x.py b/Lib/fontTools/ttLib/tables/_m_o_r_x.py index da299c6d8..dfb3abcc5 100644 --- a/Lib/fontTools/ttLib/tables/_m_o_r_x.py +++ b/Lib/fontTools/ttLib/tables/_m_o_r_x.py @@ -3,4 +3,13 @@ from .otBase import BaseTTXConverter # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html class table__m_o_r_x(BaseTTXConverter): + """The AAT ``morx`` table contains glyph transformations used for script shaping and + for various other optional smart features, akin to ``GSUB`` and ``GPOS`` features + in OpenType Layout. + + Note: ``morx`` is a replacement for the now deprecated ``mort`` table. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_n_a_m_e.py b/Lib/fontTools/ttLib/tables/_n_a_m_e.py index e30086adb..3fd1cdb48 100644 --- a/Lib/fontTools/ttLib/tables/_n_a_m_e.py +++ b/Lib/fontTools/ttLib/tables/_n_a_m_e.py @@ -36,6 +36,16 @@ nameRecordSize = sstruct.calcsize(nameRecordFormat) class table__n_a_m_e(DefaultTable.DefaultTable): + """Naming table + + The ``name`` table is used to store a variety of strings that can be + associated with user-facing font information. Records in the ``name`` + table can be tagged with language tags to support multilingual naming + and can support platform-specific character-encoding variants. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/name + """ + dependencies = ["ltag"] def decompile(self, data, ttFont): diff --git a/Lib/fontTools/ttLib/tables/_o_p_b_d.py b/Lib/fontTools/ttLib/tables/_o_p_b_d.py index b22af216b..b4c5f5682 100644 --- a/Lib/fontTools/ttLib/tables/_o_p_b_d.py +++ b/Lib/fontTools/ttLib/tables/_o_p_b_d.py @@ -3,4 +3,12 @@ from .otBase import BaseTTXConverter # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6opbd.html class table__o_p_b_d(BaseTTXConverter): + """Optical Bounds table + + The AAT ``opbd`` table contains optical boundary points for glyphs, which + applications can use for the visual alignment of lines of text. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6opbd.html + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_p_o_s_t.py b/Lib/fontTools/ttLib/tables/_p_o_s_t.py index dba637117..fca0812f9 100644 --- a/Lib/fontTools/ttLib/tables/_p_o_s_t.py +++ b/Lib/fontTools/ttLib/tables/_p_o_s_t.py @@ -27,6 +27,15 @@ postFormatSize = sstruct.calcsize(postFormat) class table__p_o_s_t(DefaultTable.DefaultTable): + """PostScript table + + The ``post`` table contains information needed to use the font on + PostScript printers, including the PostScript names of glyphs and + data that was stored in the ``FontInfo`` dictionary for Type 1 fonts. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/post + """ + def decompile(self, data, ttFont): sstruct.unpack(postFormat, data[:postFormatSize], self) data = data[postFormatSize:] diff --git a/Lib/fontTools/ttLib/tables/_p_r_e_p.py b/Lib/fontTools/ttLib/tables/_p_r_e_p.py index b4b92f3e9..cf4a5dd24 100644 --- a/Lib/fontTools/ttLib/tables/_p_r_e_p.py +++ b/Lib/fontTools/ttLib/tables/_p_r_e_p.py @@ -4,4 +4,13 @@ superclass = ttLib.getTableClass("fpgm") class table__p_r_e_p(superclass): + """Control Value Program table + + The ``prep`` table contains TrueType instructions that can makee font-wide + alterations to the Control Value Table. It may potentially be executed + before any glyph is processed. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/prep + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_p_r_o_p.py b/Lib/fontTools/ttLib/tables/_p_r_o_p.py index aead9d720..1d7de8098 100644 --- a/Lib/fontTools/ttLib/tables/_p_r_o_p.py +++ b/Lib/fontTools/ttLib/tables/_p_r_o_p.py @@ -3,4 +3,10 @@ from .otBase import BaseTTXConverter # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6prop.html class table__p_r_o_p(BaseTTXConverter): + """The AAT ``prop`` table can store a variety of per-glyph properties, such as + Unicode directionality or whether glyphs are non-spacing marks. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6prop.html + """ + pass diff --git a/Lib/fontTools/ttLib/tables/_s_b_i_x.py b/Lib/fontTools/ttLib/tables/_s_b_i_x.py index 29b82c3e4..a282ea9a6 100644 --- a/Lib/fontTools/ttLib/tables/_s_b_i_x.py +++ b/Lib/fontTools/ttLib/tables/_s_b_i_x.py @@ -28,6 +28,16 @@ sbixStrikeOffsetFormatSize = sstruct.calcsize(sbixStrikeOffsetFormat) class table__s_b_i_x(DefaultTable.DefaultTable): + """Standard Bitmap Graphics table + + The ``sbix`` table stores bitmap image data in standard graphics formats + like JPEG, PNG, or TIFF. The glyphs for which the ``sbix`` table provides + data are indexed by Glyph ID. For each such glyph, the ``sbix`` table can + hold different data for different sizes, called "strikes." + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/sbix + """ + def __init__(self, tag=None): DefaultTable.DefaultTable.__init__(self, tag) self.version = 1 diff --git a/Lib/fontTools/ttLib/tables/_t_r_a_k.py b/Lib/fontTools/ttLib/tables/_t_r_a_k.py index 0d1b313ea..b0e8e19e0 100644 --- a/Lib/fontTools/ttLib/tables/_t_r_a_k.py +++ b/Lib/fontTools/ttLib/tables/_t_r_a_k.py @@ -58,6 +58,13 @@ PER_SIZE_VALUE_FORMAT_SIZE = struct.calcsize(PER_SIZE_VALUE_FORMAT) class table__t_r_a_k(DefaultTable.DefaultTable): + """The AAT ``trak`` table can store per-size adjustments to each glyph's + sidebearings to make when tracking is enabled, which applications can + use to provide more visually balanced line spacing. + + See also https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6trak.html + """ + dependencies = ["name"] def compile(self, ttFont): diff --git a/Lib/fontTools/ttLib/tables/_v_h_e_a.py b/Lib/fontTools/ttLib/tables/_v_h_e_a.py index de7ce245a..9c6fa3aef 100644 --- a/Lib/fontTools/ttLib/tables/_v_h_e_a.py +++ b/Lib/fontTools/ttLib/tables/_v_h_e_a.py @@ -31,6 +31,18 @@ vheaFormat = """ class table__v_h_e_a(DefaultTable.DefaultTable): + """Vertical Header table + + The ``vhea`` table contains information needed during vertical + text layout. + + .. note:: + This converter class is kept in sync with the :class:`._h_h_e_a.table__h_h_e_a` + table constructor. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/vhea + """ + # Note: Keep in sync with table__h_h_e_a dependencies = ["vmtx", "glyf", "CFF ", "CFF2"] diff --git a/Lib/fontTools/ttLib/tables/_v_m_t_x.py b/Lib/fontTools/ttLib/tables/_v_m_t_x.py index a13304c32..32662fc6a 100644 --- a/Lib/fontTools/ttLib/tables/_v_m_t_x.py +++ b/Lib/fontTools/ttLib/tables/_v_m_t_x.py @@ -4,6 +4,15 @@ superclass = ttLib.getTableClass("hmtx") class table__v_m_t_x(superclass): + """Vertical Metrics table + + The ``vmtx`` table contains per-glyph metrics for the glyphs in a + ``glyf``, ``CFF ``, or ``CFF2`` table, as needed for vertical text + layout. + + See also https://learn.microsoft.com/en-us/typography/opentype/spec/vmtx + """ + headerTag = "vhea" advanceName = "height" sideBearingName = "tsb"