[AAT] Write AATLookups to XML in alphabetical order again
The XML output for other tables is also sorted alphabetically by glyph name, not by glyph order. This reverts commit c77e9fe12d5879aeb79c05f8ececebb3275524b7.
This commit is contained in:
parent
c77e9fe12d
commit
49fc88244b
@ -798,9 +798,9 @@ class AATLookup(BaseConverter):
|
|||||||
def xmlWrite(self, xmlWriter, font, value, name, attrs):
|
def xmlWrite(self, xmlWriter, font, value, name, attrs):
|
||||||
xmlWriter.begintag(name, attrs)
|
xmlWriter.begintag(name, attrs)
|
||||||
xmlWriter.newline()
|
xmlWriter.newline()
|
||||||
for glyph in sorted(value, key=font.getGlyphID):
|
for glyph, value in sorted(value.items()):
|
||||||
self.converter.xmlWrite(
|
self.converter.xmlWrite(
|
||||||
xmlWriter, font, value=value[glyph],
|
xmlWriter, font, value=value,
|
||||||
name="Lookup", attrs=[("glyph", glyph)])
|
name="Lookup", attrs=[("glyph", glyph)])
|
||||||
xmlWriter.endtag(name)
|
xmlWriter.endtag(name)
|
||||||
xmlWriter.newline()
|
xmlWriter.newline()
|
||||||
|
@ -140,7 +140,7 @@ class ANKRTest(unittest.TestCase):
|
|||||||
def decompileToXML(self, data, xml):
|
def decompileToXML(self, data, xml):
|
||||||
table = newTable('ankr')
|
table = newTable('ankr')
|
||||||
table.decompile(data, self.font)
|
table.decompile(data, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), xml)
|
self.assertEqual(getXML(table.toXML), xml)
|
||||||
|
|
||||||
def compileFromXML(self, xml, data):
|
def compileFromXML(self, xml, data):
|
||||||
table = newTable('ankr')
|
table = newTable('ankr')
|
||||||
|
@ -281,7 +281,7 @@ class BSLNTest(unittest.TestCase):
|
|||||||
def decompileToXML(self, data, xml):
|
def decompileToXML(self, data, xml):
|
||||||
table = newTable('bsln')
|
table = newTable('bsln')
|
||||||
table.decompile(data, self.font)
|
table.decompile(data, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), xml)
|
self.assertEqual(getXML(table.toXML), xml)
|
||||||
|
|
||||||
def compileFromXML(self, xml, data):
|
def compileFromXML(self, xml, data):
|
||||||
table = newTable('bsln')
|
table = newTable('bsln')
|
||||||
|
@ -25,15 +25,15 @@ LCAR_FORMAT_0_XML = [
|
|||||||
'<Version value="0x00010000"/>',
|
'<Version value="0x00010000"/>',
|
||||||
'<LigatureCarets Format="0">',
|
'<LigatureCarets Format="0">',
|
||||||
' <Carets>',
|
' <Carets>',
|
||||||
' <Lookup glyph="f_r">',
|
|
||||||
' <!-- DivsionPointCount=1 -->',
|
|
||||||
' <DivisionPoint index="0" value="220"/>',
|
|
||||||
' </Lookup>',
|
|
||||||
' <Lookup glyph="f_f_l">',
|
' <Lookup glyph="f_f_l">',
|
||||||
' <!-- DivsionPointCount=2 -->',
|
' <!-- DivsionPointCount=2 -->',
|
||||||
' <DivisionPoint index="0" value="239"/>',
|
' <DivisionPoint index="0" value="239"/>',
|
||||||
' <DivisionPoint index="1" value="472"/>',
|
' <DivisionPoint index="1" value="472"/>',
|
||||||
' </Lookup>',
|
' </Lookup>',
|
||||||
|
' <Lookup glyph="f_r">',
|
||||||
|
' <!-- DivsionPointCount=1 -->',
|
||||||
|
' <DivisionPoint index="0" value="220"/>',
|
||||||
|
' </Lookup>',
|
||||||
' </Carets>',
|
' </Carets>',
|
||||||
'</LigatureCarets>',
|
'</LigatureCarets>',
|
||||||
]
|
]
|
||||||
@ -58,15 +58,15 @@ LCAR_FORMAT_1_XML = [
|
|||||||
'<Version value="0x00010000"/>',
|
'<Version value="0x00010000"/>',
|
||||||
'<LigatureCarets Format="1">',
|
'<LigatureCarets Format="1">',
|
||||||
' <Carets>',
|
' <Carets>',
|
||||||
' <Lookup glyph="f_r">',
|
|
||||||
' <!-- DivsionPointCount=1 -->',
|
|
||||||
' <DivisionPoint index="0" value="50"/>',
|
|
||||||
' </Lookup>',
|
|
||||||
' <Lookup glyph="f_f_l">',
|
' <Lookup glyph="f_f_l">',
|
||||||
' <!-- DivsionPointCount=2 -->',
|
' <!-- DivsionPointCount=2 -->',
|
||||||
' <DivisionPoint index="0" value="55"/>',
|
' <DivisionPoint index="0" value="55"/>',
|
||||||
' <DivisionPoint index="1" value="75"/>',
|
' <DivisionPoint index="1" value="75"/>',
|
||||||
' </Lookup>',
|
' </Lookup>',
|
||||||
|
' <Lookup glyph="f_r">',
|
||||||
|
' <!-- DivsionPointCount=1 -->',
|
||||||
|
' <DivisionPoint index="0" value="50"/>',
|
||||||
|
' </Lookup>',
|
||||||
' </Carets>',
|
' </Carets>',
|
||||||
'</LigatureCarets>',
|
'</LigatureCarets>',
|
||||||
]
|
]
|
||||||
@ -82,7 +82,7 @@ class LCARTest(unittest.TestCase):
|
|||||||
def test_decompile_toXML_format0(self):
|
def test_decompile_toXML_format0(self):
|
||||||
table = newTable('lcar')
|
table = newTable('lcar')
|
||||||
table.decompile(LCAR_FORMAT_0_DATA, self.font)
|
table.decompile(LCAR_FORMAT_0_DATA, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), LCAR_FORMAT_0_XML)
|
self.assertEqual(getXML(table.toXML), LCAR_FORMAT_0_XML)
|
||||||
|
|
||||||
def test_compile_fromXML_format0(self):
|
def test_compile_fromXML_format0(self):
|
||||||
table = newTable('lcar')
|
table = newTable('lcar')
|
||||||
@ -94,7 +94,7 @@ class LCARTest(unittest.TestCase):
|
|||||||
def test_decompile_toXML_format1(self):
|
def test_decompile_toXML_format1(self):
|
||||||
table = newTable('lcar')
|
table = newTable('lcar')
|
||||||
table.decompile(LCAR_FORMAT_1_DATA, self.font)
|
table.decompile(LCAR_FORMAT_1_DATA, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), LCAR_FORMAT_1_XML)
|
self.assertEqual(getXML(table.toXML), LCAR_FORMAT_1_XML)
|
||||||
|
|
||||||
def test_compile_fromXML_format1(self):
|
def test_compile_fromXML_format1(self):
|
||||||
table = newTable('lcar')
|
table = newTable('lcar')
|
||||||
|
@ -100,7 +100,7 @@ class MORTNoncontextualGlyphSubstitutionTest(unittest.TestCase):
|
|||||||
def test_decompile_toXML(self):
|
def test_decompile_toXML(self):
|
||||||
table = newTable('mort')
|
table = newTable('mort')
|
||||||
table.decompile(MORT_NONCONTEXTUAL_DATA, self.font)
|
table.decompile(MORT_NONCONTEXTUAL_DATA, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), MORT_NONCONTEXTUAL_XML)
|
self.assertEqual(getXML(table.toXML), MORT_NONCONTEXTUAL_XML)
|
||||||
|
|
||||||
def test_compile_fromXML(self):
|
def test_compile_fromXML(self):
|
||||||
table = newTable('mort')
|
table = newTable('mort')
|
||||||
|
@ -98,7 +98,7 @@ class MORXNoncontextualGlyphSubstitutionTest(unittest.TestCase):
|
|||||||
def test_decompile_toXML(self):
|
def test_decompile_toXML(self):
|
||||||
table = newTable('morx')
|
table = newTable('morx')
|
||||||
table.decompile(MORX_NONCONTEXTUAL_DATA, self.font)
|
table.decompile(MORX_NONCONTEXTUAL_DATA, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), MORX_NONCONTEXTUAL_XML)
|
self.assertEqual(getXML(table.toXML), MORX_NONCONTEXTUAL_XML)
|
||||||
|
|
||||||
def test_compile_fromXML(self):
|
def test_compile_fromXML(self):
|
||||||
table = newTable('morx')
|
table = newTable('morx')
|
||||||
|
@ -25,18 +25,18 @@ OPBD_FORMAT_0_XML = [
|
|||||||
'<Version value="0x00010000"/>',
|
'<Version value="0x00010000"/>',
|
||||||
'<OpticalBounds Format="0">',
|
'<OpticalBounds Format="0">',
|
||||||
' <OpticalBoundsDeltas>',
|
' <OpticalBoundsDeltas>',
|
||||||
' <Lookup glyph="C">', # GlyphID 10
|
' <Lookup glyph="A">',
|
||||||
' <Left value="-50"/>',
|
|
||||||
' <Top value="5"/>',
|
|
||||||
' <Right value="55"/>',
|
|
||||||
' <Bottom value="-5"/>',
|
|
||||||
' </Lookup>',
|
|
||||||
' <Lookup glyph="A">', # GlyphID 43
|
|
||||||
' <Left value="-10"/>',
|
' <Left value="-10"/>',
|
||||||
' <Top value="15"/>',
|
' <Top value="15"/>',
|
||||||
' <Right value="0"/>',
|
' <Right value="0"/>',
|
||||||
' <Bottom value="0"/>',
|
' <Bottom value="0"/>',
|
||||||
' </Lookup>',
|
' </Lookup>',
|
||||||
|
' <Lookup glyph="C">',
|
||||||
|
' <Left value="-50"/>',
|
||||||
|
' <Top value="5"/>',
|
||||||
|
' <Right value="55"/>',
|
||||||
|
' <Bottom value="-5"/>',
|
||||||
|
' </Lookup>',
|
||||||
' </OpticalBoundsDeltas>',
|
' </OpticalBoundsDeltas>',
|
||||||
'</OpticalBounds>',
|
'</OpticalBounds>',
|
||||||
]
|
]
|
||||||
@ -61,18 +61,18 @@ OPBD_FORMAT_1_XML = [
|
|||||||
'<Version value="0x00010000"/>',
|
'<Version value="0x00010000"/>',
|
||||||
'<OpticalBounds Format="1">',
|
'<OpticalBounds Format="1">',
|
||||||
' <OpticalBoundsPoints>',
|
' <OpticalBoundsPoints>',
|
||||||
' <Lookup glyph="C">', # GlyphID 10
|
' <Lookup glyph="A">',
|
||||||
' <Left value="36"/>',
|
|
||||||
' <Top value="37"/>',
|
|
||||||
' <Right value="38"/>',
|
|
||||||
' <Bottom value="39"/>',
|
|
||||||
' </Lookup>',
|
|
||||||
' <Lookup glyph="A">', # GlyphID 43
|
|
||||||
' <Left value="32"/>',
|
' <Left value="32"/>',
|
||||||
' <Top value="41"/>',
|
' <Top value="41"/>',
|
||||||
' <Right value="-1"/>',
|
' <Right value="-1"/>',
|
||||||
' <Bottom value="-1"/>',
|
' <Bottom value="-1"/>',
|
||||||
' </Lookup>',
|
' </Lookup>',
|
||||||
|
' <Lookup glyph="C">',
|
||||||
|
' <Left value="36"/>',
|
||||||
|
' <Top value="37"/>',
|
||||||
|
' <Right value="38"/>',
|
||||||
|
' <Bottom value="39"/>',
|
||||||
|
' </Lookup>',
|
||||||
' </OpticalBoundsPoints>',
|
' </OpticalBoundsPoints>',
|
||||||
'</OpticalBounds>',
|
'</OpticalBounds>',
|
||||||
]
|
]
|
||||||
@ -149,7 +149,7 @@ class OPBDTest(unittest.TestCase):
|
|||||||
def test_decompile_toXML_format0(self):
|
def test_decompile_toXML_format0(self):
|
||||||
table = newTable('opbd')
|
table = newTable('opbd')
|
||||||
table.decompile(OPBD_FORMAT_0_DATA, self.font)
|
table.decompile(OPBD_FORMAT_0_DATA, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), OPBD_FORMAT_0_XML)
|
self.assertEqual(getXML(table.toXML), OPBD_FORMAT_0_XML)
|
||||||
|
|
||||||
def test_compile_fromXML_format0(self):
|
def test_compile_fromXML_format0(self):
|
||||||
table = newTable('opbd')
|
table = newTable('opbd')
|
||||||
@ -161,7 +161,7 @@ class OPBDTest(unittest.TestCase):
|
|||||||
def test_decompile_toXML_format1(self):
|
def test_decompile_toXML_format1(self):
|
||||||
table = newTable('opbd')
|
table = newTable('opbd')
|
||||||
table.decompile(OPBD_FORMAT_1_DATA, self.font)
|
table.decompile(OPBD_FORMAT_1_DATA, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), OPBD_FORMAT_1_XML)
|
self.assertEqual(getXML(table.toXML), OPBD_FORMAT_1_XML)
|
||||||
|
|
||||||
def test_compile_fromXML_format1(self):
|
def test_compile_fromXML_format1(self):
|
||||||
table = newTable('opbd')
|
table = newTable('opbd')
|
||||||
@ -174,9 +174,8 @@ class OPBDTest(unittest.TestCase):
|
|||||||
# Make sure we do not crash when decompiling the 'opbd' table of
|
# Make sure we do not crash when decompiling the 'opbd' table of
|
||||||
# AppleChancery.ttf. https://github.com/fonttools/fonttools/issues/1031
|
# AppleChancery.ttf. https://github.com/fonttools/fonttools/issues/1031
|
||||||
table = newTable('opbd')
|
table = newTable('opbd')
|
||||||
font = FakeFont([".notdef"] + ['G.alt%d' % i for i in range(1, 600)])
|
table.decompile(OPBD_APPLE_CHANCERY_DATA, self.font)
|
||||||
table.decompile(OPBD_APPLE_CHANCERY_DATA, font)
|
self.assertIn('<OpticalBounds Format="0">', getXML(table.toXML))
|
||||||
self.assertIn('<OpticalBounds Format="0">', getXML(table.toXML, font))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -57,7 +57,7 @@ class PROPTest(unittest.TestCase):
|
|||||||
def test_decompile_toXML_format0(self):
|
def test_decompile_toXML_format0(self):
|
||||||
table = newTable('prop')
|
table = newTable('prop')
|
||||||
table.decompile(PROP_FORMAT_0_DATA, self.font)
|
table.decompile(PROP_FORMAT_0_DATA, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), PROP_FORMAT_0_XML)
|
self.assertEqual(getXML(table.toXML), PROP_FORMAT_0_XML)
|
||||||
|
|
||||||
def test_compile_fromXML_format0(self):
|
def test_compile_fromXML_format0(self):
|
||||||
table = newTable('prop')
|
table = newTable('prop')
|
||||||
@ -69,7 +69,7 @@ class PROPTest(unittest.TestCase):
|
|||||||
def test_decompile_toXML_format1(self):
|
def test_decompile_toXML_format1(self):
|
||||||
table = newTable('prop')
|
table = newTable('prop')
|
||||||
table.decompile(PROP_FORMAT_1_DATA, self.font)
|
table.decompile(PROP_FORMAT_1_DATA, self.font)
|
||||||
self.assertEqual(getXML(table.toXML, self.font), PROP_FORMAT_1_XML)
|
self.assertEqual(getXML(table.toXML), PROP_FORMAT_1_XML)
|
||||||
|
|
||||||
def test_compile_fromXML_format1(self):
|
def test_compile_fromXML_format1(self):
|
||||||
table = newTable('prop')
|
table = newTable('prop')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user