Implement CursivePos

This commit is contained in:
Behdad Esfahbod 2015-12-08 23:25:12 +01:00
parent 515f0b3016
commit 9e28a7aaa1

View File

@ -249,7 +249,27 @@ def parsePair(self, lines, font):
def parseCursive(self, lines, font):
self.Format = 1
self.EntryExitRecord = []
raise NotImplementedError
records = {}
for line in lines:
idx,klass = {
'entry': (0,ot.EntryAnchor),
'exit': (1,ot.ExitAnchor),
}[line[0]]
glyph = parseGlyph(line[1])
x,y = intSplitComma(line[2])
if glyph not in records:
records[glyph] = [None,None]
assert records[glyph][idx] is None, (glyph, idx)
anchor = records[glyph][idx] = klass()
anchor.Format = 1
anchor.XCoordinate,anchor.YCoordinate = x,y
self.Coverage = makeCoverage(records.keys(), font)
recs = self.EntryExitRecord = []
for glyph in self.Coverage.glyphs:
rec = ot.EntryExitRecord()
rec.EntryAnchor,rec.ExitAnchor = records[glyph]
recs.append(rec)
self.EntryExitCount = len(self.EntryExitRecord)
def parseMarkToBase(self, lines, font):
self.Format = 1