Subsetting: Remove non-core tables

This commit is contained in:
Kovid Goyal 2012-11-09 21:34:53 +05:30
parent 891f362385
commit 1ee69572eb

View File

@ -94,6 +94,17 @@ def subset(raw, individual_chars, ranges=()):
# font anyway # font anyway
sfnt.pop(b'DSIG', None) sfnt.pop(b'DSIG', None)
# Remove non core tables as they aren't likely to be used by renderers
# anyway
core_tables = {b'cmap', b'hhea', b'head', b'hmtx', b'maxp', b'name',
b'OS/2', b'post', b'cvt ', b'fpgm', b'glyf', b'loca', b'prep',
b'CFF ', b'VORG', b'EBDT', b'EBLC', b'EBSC', b'BASE', b'GSUB',
b'GPOS', b'GDEF', b'JSTF', b'gasp', b'hdmx', b'kern', b'LTSH',
b'PCLT', b'VDMX', b'vhea', b'vmtx', b'MATH'}
for tag in list(sfnt):
if tag not in core_tables:
del sfnt[tag]
try: try:
cmap = sfnt[b'cmap'] cmap = sfnt[b'cmap']
except KeyError: except KeyError: