Merge pull request #1599 from khaledhosny/fealib-valuerecord-asfea
[feaLib] don’t write None in ast.ValueRecord.asFea()
This commit is contained in:
commit
dadec23978
@ -1143,6 +1143,12 @@ class ValueRecord(Expression):
|
||||
elif yAdvance is None and not vertical:
|
||||
return str(xAdvance)
|
||||
|
||||
# Make any remaining None value 0 to avoid generating invalid records.
|
||||
x = x or 0
|
||||
y = y or 0
|
||||
xAdvance = xAdvance or 0
|
||||
yAdvance = yAdvance or 0
|
||||
|
||||
# Try format B, if possible.
|
||||
if (xPlaDevice is None and yPlaDevice is None and
|
||||
xAdvDevice is None and yAdvDevice is None):
|
||||
|
@ -11,6 +11,10 @@ class AstTest(unittest.TestCase):
|
||||
statement.append(ast.GlyphName(name))
|
||||
self.assertEqual(statement.asFea(), r"[\BASE \NULL foo a]")
|
||||
|
||||
def test_valuerecord_none(self):
|
||||
statement = ast.ValueRecord(xPlacement=10, xAdvance=20)
|
||||
self.assertEqual(statement.asFea(), "<10 0 20 0>")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
Loading…
x
Reference in New Issue
Block a user