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 '
|
'Subset all embedded fonts. Every embedded font is reduced '
|
||||||
'to contain only the glyphs used in this document. This decreases '
|
'to contain only the glyphs used in this document. This decreases '
|
||||||
'the size of the font files. Useful if you are embedding a '
|
'the size of the font files. Useful if you are embedding a '
|
||||||
'particularly large font with lots of unused glyphs. Note that '
|
'particularly large font with lots of unused glyphs.')
|
||||||
'subsetting is only supported for fonts that contain TrueType '
|
|
||||||
'outlines, not Postscript outlines.')
|
|
||||||
),
|
),
|
||||||
|
|
||||||
OptionRecommendation(name='linearize_tables',
|
OptionRecommendation(name='linearize_tables',
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>655</width>
|
<width>699</width>
|
||||||
<height>619</height>
|
<height>619</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -411,7 +411,7 @@
|
|||||||
<item row="6" column="3" colspan="2">
|
<item row="6" column="3" colspan="2">
|
||||||
<widget class="QCheckBox" name="opt_subset_embedded_fonts">
|
<widget class="QCheckBox" name="opt_subset_embedded_fonts">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Subset all embedded fonts</string>
|
<string>&Subset all embedded fonts (Experimental)</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -107,7 +107,7 @@ class Subset(object):
|
|||||||
|
|
||||||
def __init__(self, cff, keep_charnames):
|
def __init__(self, cff, keep_charnames):
|
||||||
self.cff = cff
|
self.cff = cff
|
||||||
self.keep_charnames = keep_charnames
|
keep_charnames.add(b'.notdef')
|
||||||
|
|
||||||
header = pack(b'>4B', 1, 0, 4, cff.offset_size)
|
header = pack(b'>4B', 1, 0, 4, cff.offset_size)
|
||||||
|
|
||||||
@ -127,9 +127,9 @@ class Subset(object):
|
|||||||
cname = self.cff.charset.safe_lookup(i)
|
cname = self.cff.charset.safe_lookup(i)
|
||||||
if cname in keep_charnames:
|
if cname in keep_charnames:
|
||||||
char_strings.append(self.cff.char_strings[i])
|
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
|
if i > 0: # .notdef is not included
|
||||||
charsets.append(cname)
|
charsets.append(cname)
|
||||||
|
|
||||||
# Add the strings
|
# Add the strings
|
||||||
char_strings.compile()
|
char_strings.compile()
|
||||||
|
@ -167,7 +167,7 @@ def main(args):
|
|||||||
with open(iff, 'rb') as f:
|
with open(iff, 'rb') as f:
|
||||||
orig = f.read()
|
orig = f.read()
|
||||||
|
|
||||||
chars = [x.strip() for x in chars.split(',')]
|
chars = [x for x in chars.split(',')]
|
||||||
individual, ranges = set(), set()
|
individual, ranges = set(), set()
|
||||||
|
|
||||||
def not_single(c):
|
def not_single(c):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user