feaLib: support explicit 'subtable' statements in PairPos lookups

Fixes https://github.com/fonttools/fonttools/issues/1279
This commit is contained in:
Cosimo Lupo 2018-07-24 17:13:52 +01:00
parent d3229d5777
commit 9456ae9485
No known key found for this signature in database
GPG Key ID: 59D54DB0C9976482
2 changed files with 13 additions and 0 deletions

View File

@ -1077,6 +1077,9 @@ class SubtableStatement(Statement):
def __init__(self, location=None):
Statement.__init__(self, location)
def build(self, builder):
builder.add_subtable_break(self.location)
def asFea(self, indent=""):
return indent + "subtable;"

View File

@ -999,6 +999,16 @@ class Builder(object):
lookup = self.get_lookup_(location, PairPosBuilder)
lookup.addClassPair(location, glyphclass1, value1, glyphclass2, value2)
def add_subtable_break(self, location):
if type(self.cur_lookup_) is not PairPosBuilder:
raise FeatureLibError(
'explicit "subtable" statement is intended for use with only '
"Pair Adjustment Positioning Format 2 (i.e. pair class kerning)",
location
)
lookup = self.get_lookup_(location, PairPosBuilder)
lookup.add_subtable_break(location)
def add_specific_pair_pos(self, location, glyph1, value1, glyph2, value2):
lookup = self.get_lookup_(location, PairPosBuilder)
lookup.addGlyphPair(location, glyph1, value1, glyph2, value2)