OTF subsetting basically works, but leaves behind invalid entries in the GPOS table, which should be ignored by most user agents

This commit is contained in:
Kovid Goyal 2012-11-09 12:34:05 +05:30
parent 98f4cbb7e3
commit 18a3257f5d
4 changed files with 8 additions and 10 deletions

View File

@ -210,9 +210,7 @@ OptionRecommendation(name='subset_embedded_fonts',
'Subset all embedded fonts. Every embedded font is reduced '
'to contain only the glyphs used in this document. This decreases '
'the size of the font files. Useful if you are embedding a '
'particularly large font with lots of unused glyphs. Note that '
'subsetting is only supported for fonts that contain TrueType '
'outlines, not Postscript outlines.')
'particularly large font with lots of unused glyphs.')
),
OptionRecommendation(name='linearize_tables',

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>655</width>
<width>699</width>
<height>619</height>
</rect>
</property>
@ -411,7 +411,7 @@
<item row="6" column="3" colspan="2">
<widget class="QCheckBox" name="opt_subset_embedded_fonts">
<property name="text">
<string>&amp;Subset all embedded fonts</string>
<string>&amp;Subset all embedded fonts (Experimental)</string>
</property>
</widget>
</item>

View File

@ -107,7 +107,7 @@ class Subset(object):
def __init__(self, cff, keep_charnames):
self.cff = cff
self.keep_charnames = keep_charnames
keep_charnames.add(b'.notdef')
header = pack(b'>4B', 1, 0, 4, cff.offset_size)
@ -127,9 +127,9 @@ class Subset(object):
cname = self.cff.charset.safe_lookup(i)
if cname in keep_charnames:
char_strings.append(self.cff.char_strings[i])
self.charname_map[cname] = i
if i > 0: # .notdef is not included
charsets.append(cname)
self.charname_map[cname] = len(self.charname_map)
if i > 0: # .notdef is not included
charsets.append(cname)
# Add the strings
char_strings.compile()

View File

@ -167,7 +167,7 @@ def main(args):
with open(iff, 'rb') as f:
orig = f.read()
chars = [x.strip() for x in chars.split(',')]
chars = [x for x in chars.split(',')]
individual, ranges = set(), set()
def not_single(c):