mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
833a8ca4e2
commit
321e4148e7
@ -44,12 +44,14 @@ class CFF(object):
|
|||||||
offset = self.strings.pos
|
offset = self.strings.pos
|
||||||
|
|
||||||
# Read global subroutines
|
# Read global subroutines
|
||||||
self.global_subrs = GlobalSubrs(raw, offset)
|
self.global_subrs = Subrs(raw, offset)
|
||||||
offset = self.global_subrs.pos
|
offset = self.global_subrs.pos
|
||||||
|
|
||||||
# Decompile Top Dict
|
# Decompile Top Dict
|
||||||
self.top_dict.decompile(self.strings, self.global_subrs, self.top_index[0])
|
self.top_dict.decompile(self.strings, self.global_subrs, self.top_index[0])
|
||||||
self.is_CID = 'ROS' in self.top_dict
|
self.is_CID = 'ROS' in self.top_dict
|
||||||
|
if self.is_CID:
|
||||||
|
raise UnsupportedFont('Subsetting of CID keyed fonts is not supported')
|
||||||
|
|
||||||
# Read CharStrings (Glyph definitions)
|
# Read CharStrings (Glyph definitions)
|
||||||
try:
|
try:
|
||||||
@ -64,13 +66,16 @@ class CFF(object):
|
|||||||
self.num_glyphs = len(self.char_strings)
|
self.num_glyphs = len(self.char_strings)
|
||||||
|
|
||||||
# Read Private Dict
|
# Read Private Dict
|
||||||
self.private_dict = None
|
self.private_dict = self.private_subrs = None
|
||||||
pd = self.top_dict.safe_get('Private')
|
pd = self.top_dict.safe_get('Private')
|
||||||
if pd:
|
if pd:
|
||||||
size, offset = pd
|
size, offset = pd
|
||||||
self.private_dict = PrivateDict()
|
self.private_dict = PrivateDict()
|
||||||
self.private_dict.decompile(self.strings, self.global_subrs,
|
self.private_dict.decompile(self.strings, self.global_subrs,
|
||||||
raw[offset:offset+size])
|
raw[offset:offset+size])
|
||||||
|
if 'Subrs' in self.private_dict:
|
||||||
|
self.private_subrs = Subrs(raw, offset +
|
||||||
|
self.private_dict['Subrs'])
|
||||||
|
|
||||||
# Read charset (Glyph names)
|
# Read charset (Glyph names)
|
||||||
self.charset = Charset(raw, self.top_dict.safe_get('charset'),
|
self.charset = Charset(raw, self.top_dict.safe_get('charset'),
|
||||||
@ -263,7 +268,7 @@ class Charset(list):
|
|||||||
return self[glyph_id]
|
return self[glyph_id]
|
||||||
return self.STANDARD_CHARSETS[self.standard_charset][glyph_id].encode('ascii')
|
return self.STANDARD_CHARSETS[self.standard_charset][glyph_id].encode('ascii')
|
||||||
|
|
||||||
class GlobalSubrs(Index):
|
class Subrs(Index):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class CharStringsIndex(Index):
|
class CharStringsIndex(Index):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user