[otlLib] One more rename
This commit is contained in:
parent
aea0ce9ae1
commit
4e13a2268e
@ -934,7 +934,7 @@ class CursivePosBuilder(LookupBuilder):
|
|||||||
self.attachments[glyph] = (entryAnchor, exitAnchor)
|
self.attachments[glyph] = (entryAnchor, exitAnchor)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
st = otl.buildCursivePos(self.attachments, self.glyphMap)
|
st = otl.buildCursivePosSubtable(self.attachments, self.glyphMap)
|
||||||
return self.buildLookup_([st])
|
return self.buildLookup_([st])
|
||||||
|
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ def parseCursive(lines, font, _lookupMap=None):
|
|||||||
records[glyph] = [None,None]
|
records[glyph] = [None,None]
|
||||||
assert records[glyph][idx] is None, (glyph, idx)
|
assert records[glyph][idx] is None, (glyph, idx)
|
||||||
records[glyph][idx] = makeAnchor(line[2:], klass)
|
records[glyph][idx] = makeAnchor(line[2:], klass)
|
||||||
return otl.buildCursivePos(records, font.getReverseGlyphMap())
|
return otl.buildCursivePosSubtable(records, font.getReverseGlyphMap())
|
||||||
|
|
||||||
def makeMarkRecords(data, coverage, c):
|
def makeMarkRecords(data, coverage, c):
|
||||||
records = []
|
records = []
|
||||||
|
@ -20,6 +20,9 @@ LOOKUP_FLAG_USE_MARK_FILTERING_SET = 0x0010
|
|||||||
|
|
||||||
|
|
||||||
def buildLookup(subtables, flags=0, markFilterSet=None):
|
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:
|
if not subtables:
|
||||||
return None
|
return None
|
||||||
assert all(t.LookupType == subtables[0].LookupType for t in subtables), \
|
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):
|
def buildSingleSubstSubtable(mapping):
|
||||||
|
if not mapping:
|
||||||
|
return None
|
||||||
self = ot.SingleSubst()
|
self = ot.SingleSubst()
|
||||||
self.mapping = dict(mapping)
|
self.mapping = dict(mapping)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
def buildMultipleSubstSubtable(mapping):
|
def buildMultipleSubstSubtable(mapping):
|
||||||
|
if not mapping:
|
||||||
|
return None
|
||||||
self = ot.MultipleSubst()
|
self = ot.MultipleSubst()
|
||||||
self.mapping = dict(mapping)
|
self.mapping = dict(mapping)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
def buildAlternateSubstSubtable(mapping):
|
def buildAlternateSubstSubtable(mapping):
|
||||||
|
if not mapping:
|
||||||
|
return None
|
||||||
self = ot.AlternateSubst()
|
self = ot.AlternateSubst()
|
||||||
self.alternates = dict(mapping)
|
self.alternates = dict(mapping)
|
||||||
return self
|
return self
|
||||||
@ -79,6 +88,8 @@ def _getLigatureKey(components):
|
|||||||
|
|
||||||
|
|
||||||
def buildLigatureSubstSubtable(mapping):
|
def buildLigatureSubstSubtable(mapping):
|
||||||
|
if not mapping:
|
||||||
|
return None
|
||||||
self = ot.LigatureSubst()
|
self = ot.LigatureSubst()
|
||||||
# The following single line can replace the rest of this function
|
# The following single line can replace the rest of this function
|
||||||
# with fontTools >= 3.1:
|
# with fontTools >= 3.1:
|
||||||
@ -140,7 +151,7 @@ def buildComponentRecord(anchors):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
def buildCursivePos(attach, glyphMap):
|
def buildCursivePosSubtable(attach, glyphMap):
|
||||||
"""{"alef": (entry, exit)} --> otTables.CursivePos"""
|
"""{"alef": (entry, exit)} --> otTables.CursivePos"""
|
||||||
self = ot.CursivePos()
|
self = ot.CursivePos()
|
||||||
self.Format = 1
|
self.Format = 1
|
||||||
|
@ -188,7 +188,7 @@ class BuilderTest(unittest.TestCase):
|
|||||||
'</Coverage>')
|
'</Coverage>')
|
||||||
|
|
||||||
def test_buildCursivePos(self):
|
def test_buildCursivePos(self):
|
||||||
pos = builder.buildCursivePos({
|
pos = builder.buildCursivePosSubtable({
|
||||||
"two": (self.ANCHOR1, self.ANCHOR2),
|
"two": (self.ANCHOR1, self.ANCHOR2),
|
||||||
"four": (self.ANCHOR3, self.ANCHOR1)
|
"four": (self.ANCHOR3, self.ANCHOR1)
|
||||||
}, self.GLYPHMAP)
|
}, self.GLYPHMAP)
|
||||||
@ -467,6 +467,8 @@ class BuilderTest(unittest.TestCase):
|
|||||||
def test_buildLookup_noSubtables(self):
|
def test_buildLookup_noSubtables(self):
|
||||||
self.assertIsNone(builder.buildLookup([]))
|
self.assertIsNone(builder.buildLookup([]))
|
||||||
self.assertIsNone(builder.buildLookup(None))
|
self.assertIsNone(builder.buildLookup(None))
|
||||||
|
self.assertIsNone(builder.buildLookup([None]))
|
||||||
|
self.assertIsNone(builder.buildLookup([None, None]))
|
||||||
|
|
||||||
def test_buildLookup_markFilterSet(self):
|
def test_buildLookup_markFilterSet(self):
|
||||||
s = builder.buildSingleSubstSubtable({"one": "two"})
|
s = builder.buildSingleSubstSubtable({"one": "two"})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user