mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
85d09338d7
commit
2bd084ba23
@ -104,12 +104,14 @@ def decode_name_record(recs):
|
|||||||
Get the English names of this font. See
|
Get the English names of this font. See
|
||||||
http://www.microsoft.com/typography/otspec/name.htm for details.
|
http://www.microsoft.com/typography/otspec/name.htm for details.
|
||||||
'''
|
'''
|
||||||
if not recs: return None
|
if not recs:
|
||||||
|
return None
|
||||||
unicode_names = {}
|
unicode_names = {}
|
||||||
windows_names = {}
|
windows_names = {}
|
||||||
mac_names = {}
|
mac_names = {}
|
||||||
for platform_id, encoding_id, language_id, src in recs:
|
for platform_id, encoding_id, language_id, src in recs:
|
||||||
if language_id > 0x8000: continue
|
if language_id > 0x8000:
|
||||||
|
continue
|
||||||
if platform_id == 0:
|
if platform_id == 0:
|
||||||
if encoding_id < 4:
|
if encoding_id < 4:
|
||||||
try:
|
try:
|
||||||
@ -124,14 +126,16 @@ def decode_name_record(recs):
|
|||||||
elif platform_id == 2:
|
elif platform_id == 2:
|
||||||
codec = {0:'ascii', 1:'utf-16-be', 2:'iso-8859-1'}.get(encoding_id,
|
codec = {0:'ascii', 1:'utf-16-be', 2:'iso-8859-1'}.get(encoding_id,
|
||||||
None)
|
None)
|
||||||
if codec is None: continue
|
if codec is None:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
unicode_names[language_id] = src.decode(codec)
|
unicode_names[language_id] = src.decode(codec)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
continue
|
continue
|
||||||
elif platform_id == 3:
|
elif platform_id == 3:
|
||||||
codec = {1:16, 10:32}.get(encoding_id, None)
|
codec = {1:16, 10:32}.get(encoding_id, None)
|
||||||
if codec is None: continue
|
if codec is None:
|
||||||
|
continue
|
||||||
try:
|
try:
|
||||||
windows_names[language_id] = src.decode('utf-%d-be'%codec)
|
windows_names[language_id] = src.decode('utf-%d-be'%codec)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user