mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Use alphabetical order in the sfnt header as per the spec
This commit is contained in:
parent
1d9398e009
commit
bd9fd5485b
@ -58,16 +58,21 @@ class Sfnt(object):
|
|||||||
del self.tables[key]
|
del self.tables[key]
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
'''Iterate over the table tags in optimal order as per
|
'''Iterate over the table tags in order.'''
|
||||||
http://partners.adobe.com/public/developer/opentype/index_recs.html'''
|
for x in sorted(self.tables.iterkeys()):
|
||||||
keys = list(self.tables.keys())
|
|
||||||
order = {x:i for i, x in enumerate((b'head', b'hhea', b'maxp', b'OS/2',
|
|
||||||
b'hmtx', b'LTSH', b'VDMX', b'hdmx', b'cmap', b'fpgm', b'prep',
|
|
||||||
b'cvt ', b'loca', b'glyf', b'CFF ', b'kern', b'name', b'post',
|
|
||||||
b'gasp', b'PCLT', b'DSIG'))}
|
|
||||||
keys.sort(key=lambda x:order.get(x, 1000))
|
|
||||||
for x in keys:
|
|
||||||
yield x
|
yield x
|
||||||
|
# Although the optimal order is not alphabetical, the OTF spec says
|
||||||
|
# they should be alphabetical, so we stick with that. See
|
||||||
|
# http://partners.adobe.com/public/developer/opentype/index_recs.html
|
||||||
|
# for optimal order.
|
||||||
|
# keys = list(self.tables.iterkeys())
|
||||||
|
# order = {x:i for i, x in enumerate((b'head', b'hhea', b'maxp', b'OS/2',
|
||||||
|
# b'hmtx', b'LTSH', b'VDMX', b'hdmx', b'cmap', b'fpgm', b'prep',
|
||||||
|
# b'cvt ', b'loca', b'glyf', b'CFF ', b'kern', b'name', b'post',
|
||||||
|
# b'gasp', b'PCLT', b'DSIG'))}
|
||||||
|
# keys.sort(key=lambda x:order.get(x, 1000))
|
||||||
|
# for x in keys:
|
||||||
|
# yield x
|
||||||
|
|
||||||
def pop(self, key, default=None):
|
def pop(self, key, default=None):
|
||||||
return self.tables.pop(key, default)
|
return self.tables.pop(key, default)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user