summaryrefslogtreecommitdiff
path: root/tools/fonts/fontchain_linter.py
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-03-05 11:58:47 -0800
committerHaibo Huang <hhb@google.com>2020-03-07 02:02:19 +0000
commit715857dbda507198c70df1b043f9eb34161fea87 (patch)
tree2ec90e49fd9e3ca5d16f99073821e2a8be4c5bab /tools/fonts/fontchain_linter.py
parent3bc5168281afbb541458d19ffd7f38e070ec6afe (diff)
Uses python3 for fontTools
Change-Id: I33bb8881823278c990faeb1a0e119f855c9948b9
Diffstat (limited to 'tools/fonts/fontchain_linter.py')
-rwxr-xr-xtools/fonts/fontchain_linter.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tools/fonts/fontchain_linter.py b/tools/fonts/fontchain_linter.py
index 6683e2abb0da..a4a315b7e371 100755
--- a/tools/fonts/fontchain_linter.py
+++ b/tools/fonts/fontchain_linter.py
@@ -286,7 +286,7 @@ def parse_fonts_xml(fonts_xml_path):
if not fallback_for:
if not name or name == 'sans-serif':
- for _, fallback in _fallback_chains.iteritems():
+ for _, fallback in _fallback_chains.items():
fallback.append(record)
else:
_fallback_chains[name].append(record)
@@ -327,7 +327,7 @@ def check_emoji_font_coverage(emoji_font, all_emoji, equivalent_emoji):
assert sequence in all_emoji, (
'Emoji font should not support %s.' % printable(sequence))
- for first, second in sorted(equivalent_emoji.items()):
+ for first, second in equivalent_emoji.items():
assert coverage[first] == coverage[second], (
'%s and %s should map to the same glyph.' % (
printable(first),
@@ -352,7 +352,7 @@ def check_emoji_font_coverage(emoji_font, all_emoji, equivalent_emoji):
def check_emoji_defaults(default_emoji):
missing_text_chars = _emoji_properties['Emoji'] - default_emoji
- for name, fallback_chain in _fallback_chains.iteritems():
+ for name, fallback_chain in _fallback_chains.items():
emoji_font_seen = False
for record in fallback_chain:
if 'Zsye' in record.scripts:
@@ -369,7 +369,7 @@ def check_emoji_defaults(default_emoji):
continue
# Check default emoji-style characters
- assert_font_supports_none_of_chars(record.font, sorted(default_emoji), name)
+ assert_font_supports_none_of_chars(record.font, default_emoji, name)
# Mark default text-style characters appearing in fonts above the emoji
# font as seen
@@ -412,7 +412,7 @@ def parse_unicode_datafile(file_path, reverse=False):
char_start, char_end = chars.split('..')
char_start = int(char_start, 16)
char_end = int(char_end, 16)
- additions = xrange(char_start, char_end+1)
+ additions = range(char_start, char_end+1)
else: # singe character
additions = [int(chars, 16)]
if reverse:
@@ -478,7 +478,7 @@ def parse_ucd(ucd_path):
# Unicode 12.0 adds Basic_Emoji in emoji-sequences.txt. We ignore them here since we are already
# checking the emoji presentations with emoji-variation-sequences.txt.
# Please refer to http://unicode.org/reports/tr51/#def_basic_emoji_set .
- _emoji_sequences = {k: v for k, v in _emoji_sequences.iteritems() if not v == 'Basic_Emoji' }
+ _emoji_sequences = {k: v for k, v in _emoji_sequences.items() if not v == 'Basic_Emoji' }
def remove_emoji_variation_exclude(source, items):
@@ -551,7 +551,7 @@ def reverse_emoji(seq):
rev = list(reversed(seq))
# if there are fitzpatrick modifiers in the sequence, keep them after
# the emoji they modify
- for i in xrange(1, len(rev)):
+ for i in range(1, len(rev)):
if is_fitzpatrick_modifier(rev[i-1]):
rev[i], rev[i-1] = rev[i-1], rev[i]
return tuple(rev)
@@ -620,7 +620,7 @@ def compute_expected_emoji():
def check_compact_only_fallback():
- for name, fallback_chain in _fallback_chains.iteritems():
+ for name, fallback_chain in _fallback_chains.items():
for record in fallback_chain:
if record.variant == 'compact':
same_script_elegants = [x for x in fallback_chain
@@ -650,7 +650,7 @@ def check_vertical_metrics():
def check_cjk_punctuation():
cjk_scripts = {'Hans', 'Hant', 'Jpan', 'Kore'}
cjk_punctuation = range(0x3000, 0x301F + 1)
- for name, fallback_chain in _fallback_chains.iteritems():
+ for name, fallback_chain in _fallback_chains.items():
for record in fallback_chain:
if record.scripts.intersection(cjk_scripts):
# CJK font seen. Stop checking the rest of the fonts.