[otlLib] One more rename

This commit is contained in:
Behdad Esfahbod 2016-01-22 19:38:20 +01:00
parent aea0ce9ae1
commit 4e13a2268e
4 changed files with 17 additions and 4 deletions

View File

@ -934,7 +934,7 @@ class CursivePosBuilder(LookupBuilder):
self.attachments[glyph] = (entryAnchor, exitAnchor)
def build(self):
st = otl.buildCursivePos(self.attachments, self.glyphMap)
st = otl.buildCursivePosSubtable(self.attachments, self.glyphMap)
return self.buildLookup_([st])

View File

@ -354,7 +354,7 @@ def parseCursive(lines, font, _lookupMap=None):
records[glyph] = [None,None]
assert records[glyph][idx] is None, (glyph, idx)
records[glyph][idx] = makeAnchor(line[2:], klass)
return otl.buildCursivePos(records, font.getReverseGlyphMap())
return otl.buildCursivePosSubtable(records, font.getReverseGlyphMap())
def makeMarkRecords(data, coverage, c):
records = []

View File

@ -20,6 +20,9 @@ LOOKUP_FLAG_USE_MARK_FILTERING_SET = 0x0010
def buildLookup(subtables, flags=0, markFilterSet=None):
if subtables is None:
return None
subtables = [st for st in subtables if st is not None]
if not subtables:
return None
assert all(t.LookupType == subtables[0].LookupType for t in subtables), \
@ -47,18 +50,24 @@ def buildLookup(subtables, flags=0, markFilterSet=None):
def buildSingleSubstSubtable(mapping):
if not mapping:
return None
self = ot.SingleSubst()
self.mapping = dict(mapping)
return self
def buildMultipleSubstSubtable(mapping):
if not mapping:
return None
self = ot.MultipleSubst()
self.mapping = dict(mapping)
return self
def buildAlternateSubstSubtable(mapping):
if not mapping:
return None
self = ot.AlternateSubst()
self.alternates = dict(mapping)
return self
@ -79,6 +88,8 @@ def _getLigatureKey(components):
def buildLigatureSubstSubtable(mapping):
if not mapping:
return None
self = ot.LigatureSubst()
# The following single line can replace the rest of this function
# with fontTools >= 3.1:
@ -140,7 +151,7 @@ def buildComponentRecord(anchors):
return self
def buildCursivePos(attach, glyphMap):
def buildCursivePosSubtable(attach, glyphMap):
"""{"alef": (entry, exit)} --> otTables.CursivePos"""
self = ot.CursivePos()
self.Format = 1

View File

@ -188,7 +188,7 @@ class BuilderTest(unittest.TestCase):
'</Coverage>')
def test_buildCursivePos(self):
pos = builder.buildCursivePos({
pos = builder.buildCursivePosSubtable({
"two": (self.ANCHOR1, self.ANCHOR2),
"four": (self.ANCHOR3, self.ANCHOR1)
}, self.GLYPHMAP)
@ -467,6 +467,8 @@ class BuilderTest(unittest.TestCase):
def test_buildLookup_noSubtables(self):
self.assertIsNone(builder.buildLookup([]))
self.assertIsNone(builder.buildLookup(None))
self.assertIsNone(builder.buildLookup([None]))
self.assertIsNone(builder.buildLookup([None, None]))
def test_buildLookup_markFilterSet(self):
s = builder.buildSingleSubstSubtable({"one": "two"})