aboutsummaryrefslogtreecommitdiff
path: root/Lib/fontTools/ttLib/tables/otTables.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/fontTools/ttLib/tables/otTables.py')
-rw-r--r--Lib/fontTools/ttLib/tables/otTables.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/Lib/fontTools/ttLib/tables/otTables.py b/Lib/fontTools/ttLib/tables/otTables.py
index b821fa36..31ff0122 100644
--- a/Lib/fontTools/ttLib/tables/otTables.py
+++ b/Lib/fontTools/ttLib/tables/otTables.py
@@ -12,6 +12,7 @@ from fontTools.misc.py23 import *
from fontTools.misc.fixedTools import otRound
from fontTools.misc.textTools import pad, safeEval
from .otBase import BaseTable, FormatSwitchingBaseTable, ValueRecord, CountReference
+from fontTools.feaLib.lookupDebugInfo import LookupDebugInfo, LOOKUP_DEBUG_INFO_KEY
import logging
import struct
@@ -1187,6 +1188,44 @@ class COLR(BaseTable):
}
+class LookupList(BaseTable):
+ @property
+ def table(self):
+ for l in self.Lookup:
+ for st in l.SubTable:
+ if type(st).__name__.endswith("Subst"):
+ return "GSUB"
+ if type(st).__name__.endswith("Pos"):
+ return "GPOS"
+ raise ValueError
+
+ def toXML2(self, xmlWriter, font):
+ if not font or "Debg" not in font or LOOKUP_DEBUG_INFO_KEY not in font["Debg"].data:
+ return super().toXML2(xmlWriter, font)
+ debugData = font["Debg"].data[LOOKUP_DEBUG_INFO_KEY][self.table]
+ for conv in self.getConverters():
+ if conv.repeat:
+ value = getattr(self, conv.name, [])
+ for lookupIndex, item in enumerate(value):
+ if str(lookupIndex) in debugData:
+ info = LookupDebugInfo(*debugData[str(lookupIndex)])
+ tag = info.location
+ if info.name:
+ tag = f'{info.name}: {tag}'
+ if info.feature:
+ script,language,feature = info.feature
+ tag = f'{tag} in {feature} ({script}/{language})'
+ xmlWriter.comment(tag)
+ xmlWriter.newline()
+
+ conv.xmlWrite(xmlWriter, font, item, conv.name,
+ [("index", lookupIndex)])
+ else:
+ if conv.aux and not eval(conv.aux, None, vars(self)):
+ continue
+ value = getattr(self, conv.name, None) # TODO Handle defaults instead of defaulting to None!
+ conv.xmlWrite(xmlWriter, font, value, conv.name, [])
+
class BaseGlyphRecordArray(BaseTable):
def preWrite(self, font):