mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
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:
parent
98f4cbb7e3
commit
18a3257f5d
@ -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',
|
||||
|
@ -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>&Subset all embedded fonts</string>
|
||||
<string>&Subset all embedded fonts (Experimental)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -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,7 +127,7 @@ 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
|
||||
self.charname_map[cname] = len(self.charname_map)
|
||||
if i > 0: # .notdef is not included
|
||||
charsets.append(cname)
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user