Implement ligature subtitutions

This commit is contained in:
Behdad Esfahbod 2015-10-17 03:43:31 -03:00
parent dffdd91aec
commit 60782c5e92

View File

@ -88,33 +88,52 @@ def appendSingleSubst(self, line):
mapping[line[0]] = line[1] mapping[line[0]] = line[1]
def appendMultiple(self, line): def appendMultiple(self, line):
debug(line)
raise NotImplementedError raise NotImplementedError
def appendAlternate(self, line): def appendAlternate(self, line):
debug(line)
raise NotImplementedError raise NotImplementedError
def appendLigature(self, line): def appendLigature(self, line):
raise NotImplementedError ligatures = getattr(self, "ligatures", None)
if ligatures is None:
self.ligatures = ligatures = {}
ligGlyph, firstGlyph = line[:2]
otherComponents = line[2:]
if firstGlyph not in ligatures:
ligatures[firstGlyph] = []
ligature = ot.Ligature()
ligature.Component = otherComponents
ligature.CompCount = len(ligature.Component) + 1
ligature.LigGlyph = ligGlyph
ligatures[firstGlyph].append(ligature)
def appendSinglePos(self, line): def appendSinglePos(self, line):
debug(line)
raise NotImplementedError raise NotImplementedError
def appendPair(self, line): def appendPair(self, line):
raise NotImplementedError raise NotImplementedError
def appendCursive(self, line): def appendCursive(self, line):
debug(line)
raise NotImplementedError raise NotImplementedError
def appendMarkToSomething(self, line): def appendMarkToSomething(self, line):
debug(line)
raise NotImplementedError raise NotImplementedError
def appendMarkToLigature(self, line): def appendMarkToLigature(self, line):
debug(line)
raise NotImplementedError raise NotImplementedError
def appendContext(self, line): def appendContext(self, line):
debug(line)
raise NotImplementedError raise NotImplementedError
def appendChained(self, line): def appendChained(self, line):
debug(line)
raise NotImplementedError raise NotImplementedError
def parseLookupList(lines, tableTag): def parseLookupList(lines, tableTag):
@ -164,6 +183,9 @@ def parseLookupList(lines, tableTag):
if line[1] == 'yes': if line[1] == 'yes':
lookup.LookupFlags |= flag lookup.LookupFlags |= flag
continue continue
if line[0] == 'MarkAttachmentType':
lookup.LookupFlags |= int(line[1]) << 8
continue
if len(line) > 1 or line[0] != '': if len(line) > 1 or line[0] != '':
append(subtable, line) append(subtable, line)