mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-28 07:47:42 +01:00
py3: Fix decoding of CFF font tables
This commit is contained in:
parent
09aae8b299
commit
7474547bd2
1 changed files with 4 additions and 7 deletions
|
|
@ -6,7 +6,7 @@
|
|||
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from struct import unpack, pack
|
||||
from struct import pack, unpack_from
|
||||
from polyglot.builtins import range, unicode_type
|
||||
|
||||
t1_operand_encoding = [None] * 256
|
||||
|
|
@ -44,18 +44,15 @@ def read_small_int2(self, b0, data, index):
|
|||
return -(b0-251)*256 - b1 - 108, index+1
|
||||
|
||||
def read_short_int(self, b0, data, index):
|
||||
bin = data[index] + data[index+1]
|
||||
value, = unpack(b">h", bin)
|
||||
value, = unpack_from(b">h", data, index)
|
||||
return value, index+2
|
||||
|
||||
def read_long_int(self, b0, data, index):
|
||||
bin = data[index] + data[index+1] + data[index+2] + data[index+3]
|
||||
value, = unpack(b">l", bin)
|
||||
value, = unpack_from(b">l", data, index)
|
||||
return value, index+4
|
||||
|
||||
def read_fixed_1616(self, b0, data, index):
|
||||
bin = data[index] + data[index+1] + data[index+2] + data[index+3]
|
||||
value, = unpack(b">l", bin)
|
||||
value, = unpack_from(b">l", data, index)
|
||||
return value / 65536.0, index+4
|
||||
|
||||
def read_real_number(self, b0, data, index):
|
||||
|
|
|
|||
Loading…
Reference in a new issue