File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 24
24
import binascii
25
25
import enum
26
26
import itertools
27
+ import logging
27
28
import re
28
29
import struct
29
30
30
31
import numpy as np
31
32
32
33
from matplotlib .cbook import _format_approx
33
34
35
+ _log = logging .getLogger (__name__ )
34
36
35
37
# token types
36
38
_TokenType = enum .Enum ('_TokenType' ,
@@ -128,13 +130,16 @@ def _split(self, data):
128
130
zeros -= 1
129
131
idx -= 1
130
132
if zeros :
131
- raise RuntimeError ('Insufficiently many zeros in Type 1 font' )
133
+ # this may have been a problem on old implementations that
134
+ # used the zeros as necessary padding
135
+ _log .info ('Insufficiently many zeros in Type 1 font' )
132
136
133
137
# Convert encrypted part to binary (if we read a pfb file, we may end
134
138
# up converting binary to hexadecimal to binary again; but if we read
135
139
# a pfa file, this part is already in hex, and I am not quite sure if
136
140
# even the pfb format guarantees that it will be in binary).
137
- binary = binascii .unhexlify (data [len1 :idx + 1 ])
141
+ idx1 = len1 + ((idx - len1 + 2 ) & ~ 1 ) # ensure an even number of bytes
142
+ binary = binascii .unhexlify (data [len1 :idx1 ])
138
143
139
144
return data [:len1 ], binary , data [idx + 1 :]
140
145
You can’t perform that action at this time.
0 commit comments