1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-24 15:11:30 +02:00

Removed polyglots unicode_type usage

This commit is contained in:
2020-04-20 19:25:28 +02:00
parent ef7e2b10be
commit 128705f258
130 changed files with 657 additions and 716 deletions
@@ -2,7 +2,7 @@ from collections import defaultdict
from ebook_converter.ebooks.oeb.base import urlnormalize, css_text
from ebook_converter.utils.fonts.sfnt.subset import subset, NoGlyphs, UnsupportedFont
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type
from ebook_converter.polyglot.builtins import iteritems, itervalues
from ebook_converter.tinycss.fonts3 import parse_font_family
@@ -32,7 +32,7 @@ def get_font_properties(rule, default=None):
except (IndexError, KeyError, AttributeError, TypeError, ValueError):
val = None if q in {'src', 'font-family'} else default
if q in {'font-weight', 'font-stretch', 'font-style'}:
val = unicode_type(val).lower() if (val or val == 0) else val
val = str(val).lower() if (val or val == 0) else val
if val == 'inherit':
val = default
if q == 'font-weight':
@@ -233,7 +233,7 @@ class SubsetFonts(object):
no match is found (can happen if no family matches).
'''
ff = style.get('font-family', [])
lnames = {unicode_type(x).lower() for x in ff}
lnames = {str(x).lower() for x in ff}
matching_set = []
# Filter on font-family