Add debug info to MTI feature builds

This commit is contained in:
Simon Cozens 2023-03-02 20:42:37 +00:00
parent 48f68877a8
commit b22887c6b6

View File

@ -12,6 +12,8 @@ from fontTools.ttLib.tables import otTables as ot
from fontTools.ttLib.tables.otBase import ValueRecord, valueRecordFormatDict from fontTools.ttLib.tables.otBase import ValueRecord, valueRecordFormatDict
from fontTools.otlLib import builder as otl from fontTools.otlLib import builder as otl
from contextlib import contextmanager from contextlib import contextmanager
from fontTools.ttLib import newTable
from fontTools.feaLib.lookupDebugInfo import LOOKUP_DEBUG_INFO_KEY
from operator import setitem from operator import setitem
import logging import logging
@ -1036,7 +1038,13 @@ def parseGSUBGPOS(lines, font, tableTag):
self.LookupList.LookupCount = len(self.LookupList.Lookup) self.LookupList.LookupCount = len(self.LookupList.Lookup)
if lookupMap is not None: if lookupMap is not None:
lookupMap.applyDeferredMappings() lookupMap.applyDeferredMappings()
if featureMap is not None: if "Debg" not in font:
font["Debg"] = newTable("Debg")
font["Debg"].data = {}
debug = font["Debg"].data.setdefault(LOOKUP_DEBUG_INFO_KEY, {}).setdefault(tableTag, {})
for name, lookup in lookupMap.items():
debug[str(lookup)] = ["", name, ""]
featureMap.applyDeferredMappings() featureMap.applyDeferredMappings()
container.table = self container.table = self
return container return container