File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -189,7 +189,9 @@ def _parse_char_metrics(fh):
189
189
ascii_d = {}
190
190
name_d = {}
191
191
for line in fh :
192
- line = line .rstrip ().decode ('ascii' ) # Convert from byte-literal
192
+ # We are defensively letting values be utf8. The spec requires
193
+ # ascii, but there are non-compliant fonts in circulation
194
+ line = _to_str (line .rstrip ()) # Convert from byte-literal
193
195
if line .startswith ('EndCharMetrics' ):
194
196
return ascii_d , name_d
195
197
# Split the metric line into a dictionary, keyed by metric identifiers
@@ -392,7 +394,7 @@ def get_str_bbox_and_descent(self, s):
392
394
maxy = 0
393
395
left = 0
394
396
if not isinstance (s , six .text_type ):
395
- s = s . decode ( 'ascii' )
397
+ s = _to_str ( s )
396
398
for c in s :
397
399
if c == '\n ' :
398
400
continue
You can’t perform that action at this time.
0 commit comments