[otlLib] Ensure built PairPos1 ValueRecords are padded with 0s

Like when decompiled.

See 2089d05126 (r48578120)

Part of https://github.com/fonttools/fonttools/pull/2237
This commit is contained in:
Cosimo Lupo 2021-03-23 12:43:10 +00:00 committed by Behdad Esfahbod
parent 0e5fe2d1d7
commit b1ca16738c
2 changed files with 5 additions and 3 deletions

View File

@ -2190,8 +2190,8 @@ def buildPairPosGlyphsSubtable(pairs, glyphMap, valueFormat1=None, valueFormat2=
for glyph2, val1, val2 in sorted(p[glyph], key=lambda x: glyphMap[x[0]]):
pvr = ot.PairValueRecord()
pvr.SecondGlyph = glyph2
pvr.Value1 = val1 if valueFormat1 else None
pvr.Value2 = val2 if valueFormat2 else None
pvr.Value1 = ValueRecord(src=val1, valueFormat=valueFormat1) if valueFormat1 else None
pvr.Value2 = ValueRecord(src=val2, valueFormat=valueFormat2) if valueFormat2 else None
ps.PairValueRecord.append(pvr)
ps.PairValueCount = len(ps.PairValueRecord)
self.PairSetCount = len(self.PairSet)

View File

@ -922,6 +922,7 @@ class BuilderTest(object):
},
self.GLYPHMAP,
)
assert getXML(subtable.toXML) == [
'<PairPos Format="1">',
" <Coverage>",
@ -935,11 +936,12 @@ class BuilderTest(object):
" <!-- PairValueCount=2 -->",
' <PairValueRecord index="0">',
' <SecondGlyph value="zero"/>',
' <Value1/>',
' <Value1 XPlacement="0" YPlacement="0"/>',
' <Value2 XPlacement="-50"/>',
" </PairValueRecord>",
' <PairValueRecord index="1">',
' <SecondGlyph value="one"/>',
' <Value1 XPlacement="0" YPlacement="0"/>',
' <Value2 XPlacement="-20"/>',
" </PairValueRecord>",
" </PairSet>",