diff --git a/Lib/fontTools/ttLib/tables/otConverters.py b/Lib/fontTools/ttLib/tables/otConverters.py index cf47ab012..cd6aac941 100644 --- a/Lib/fontTools/ttLib/tables/otConverters.py +++ b/Lib/fontTools/ttLib/tables/otConverters.py @@ -24,8 +24,11 @@ def buildConverters(tableSpec, tableNamespace): assert tp == "uint16" converterClass = ValueFormat elif name.endswith("Count") or name == "MorphType": - assert tp in ("uint16", "uint32") - converterClass = ComputedUShort if tp == 'uint16' else ComputedULong + converterClass = { + "uint8": ComputedUInt8, + "uint16": ComputedUShort, + "uint32": ComputedULong, + }[tp] elif name == "SubTable": converterClass = SubTable elif name == "ExtSubTable": @@ -218,6 +221,8 @@ class ComputedInt(IntValue): xmlWriter.comment("%s=%s" % (name, value)) xmlWriter.newline() +class ComputedUInt8(ComputedInt, UInt8): + pass class ComputedUShort(ComputedInt, UShort): pass class ComputedULong(ComputedInt, ULong): diff --git a/Lib/fontTools/ttLib/tables/otData.py b/Lib/fontTools/ttLib/tables/otData.py index 0088f3b7f..a67e2a20a 100755 --- a/Lib/fontTools/ttLib/tables/otData.py +++ b/Lib/fontTools/ttLib/tables/otData.py @@ -1,3 +1,4 @@ +# coding: utf-8 from __future__ import print_function, division, absolute_import from fontTools.misc.py23 import * @@ -1247,11 +1248,14 @@ otData = [ ('Flags32', 'DisableFlags', None, None, 'Complement of flags for the settings that this feature and setting disable.'), ]), + # Apple TrueType Reference Manual, chapter “The ‘morx’ table”, + # section “Metamorphosis Subtables”. + # https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6morx.html ('MorphSubtable', [ ('uint32', 'StructLength', None, None, 'Total subtable length, including this header.'), ('uint8', 'CoverageFlags', None, None, 'Most significant byte of coverage flags.'), - ('uint8', 'Reserved', None, None, 'Unused.'), - ('uint16', 'MorphType', None, None, 'Subtable type.'), + ('uint16', 'Reserved', None, None, 'Unused.'), + ('uint8', 'MorphType', None, None, 'Subtable type.'), ('Flags32', 'SubFeatureFlags', None, None, 'The 32-bit mask identifying which subtable this is (the subtable being executed if the AND of this value and the processed defaultFlags is nonzero).'), ('SubStruct', 'SubStruct', None, None, 'SubTable.'), ]),