Support multiple subtables per lookup
This commit is contained in:
parent
5bc565524a
commit
2bf82e5534
19
fd2ft.py
19
fd2ft.py
@ -481,12 +481,19 @@ def parseLookup(lines, tableTag, font):
|
|||||||
'chained': (8, parseChainedPos),
|
'chained': (8, parseChainedPos),
|
||||||
},
|
},
|
||||||
}[tableTag][typ]
|
}[tableTag][typ]
|
||||||
|
|
||||||
|
subtables = []
|
||||||
|
|
||||||
|
while True:
|
||||||
|
subLookupLines = lookupLines.readUntil(('% subtable', 'subtable end'))
|
||||||
|
if subLookupLines.peek() is None:
|
||||||
|
break
|
||||||
subtable = ot.lookupTypes[tableTag][lookup.LookupType]()
|
subtable = ot.lookupTypes[tableTag][lookup.LookupType]()
|
||||||
subtable.LookupType = lookup.LookupType
|
subtable.LookupType = lookup.LookupType
|
||||||
|
parseLookupSubTable(subtable, subLookupLines, font)
|
||||||
|
subtables.append(subtable)
|
||||||
|
|
||||||
parseLookupSubTable(subtable, lookupLines, font)
|
lookup.SubTable = subtables
|
||||||
|
|
||||||
lookup.SubTable = [subtable]
|
|
||||||
lookup.SubTableCount = len(lookup.SubTable)
|
lookup.SubTableCount = len(lookup.SubTable)
|
||||||
return lookup, name
|
return lookup, name
|
||||||
|
|
||||||
@ -529,8 +536,10 @@ def parseGDEF(lines, font):
|
|||||||
class ReadUntilMixin(object):
|
class ReadUntilMixin(object):
|
||||||
|
|
||||||
def _readUntil(self, what):
|
def _readUntil(self, what):
|
||||||
|
if type(what) is not tuple:
|
||||||
|
what = (what,)
|
||||||
for line in self:
|
for line in self:
|
||||||
if line[0].lower() == what:
|
if line[0].lower() in what:
|
||||||
raise StopIteration
|
raise StopIteration
|
||||||
yield line
|
yield line
|
||||||
def readUntil(self, what):
|
def readUntil(self, what):
|
||||||
@ -589,7 +598,7 @@ class Tokenizer(ReadUntilMixin):
|
|||||||
while True:
|
while True:
|
||||||
line = self._next()
|
line = self._next()
|
||||||
# Skip comments and empty lines
|
# Skip comments and empty lines
|
||||||
if line[0] and line[0][0] != '%':
|
if line[0] and (line[0][0] != '%' or line[0] == '% subtable'):
|
||||||
return line
|
return line
|
||||||
|
|
||||||
def skipUntil(self, what):
|
def skipUntil(self, what):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user