mirror of
https://github.com/googlefonts/noto-emoji.git
synced 2025-06-08 07:47:59 +00:00
fail when not compliant
This commit is contained in:
parent
ed33b0c479
commit
09da7bdb59
1 changed files with 10 additions and 0 deletions
|
@ -243,6 +243,7 @@ def _check_coverage(seq_to_filepath, unicode_version):
|
||||||
"""Ensure we have all and only the cps and sequences that we need for the
|
"""Ensure we have all and only the cps and sequences that we need for the
|
||||||
font as of this version."""
|
font as of this version."""
|
||||||
|
|
||||||
|
coverage_pass = True
|
||||||
age = unicode_version
|
age = unicode_version
|
||||||
|
|
||||||
non_vs_to_canonical = {}
|
non_vs_to_canonical = {}
|
||||||
|
@ -257,11 +258,13 @@ def _check_coverage(seq_to_filepath, unicode_version):
|
||||||
alias_str = unicode_data.seq_to_string(k)
|
alias_str = unicode_data.seq_to_string(k)
|
||||||
target_str = unicode_data.seq_to_string(v)
|
target_str = unicode_data.seq_to_string(v)
|
||||||
print(f'coverage: alias {alias_str} missing target {target_str}')
|
print(f'coverage: alias {alias_str} missing target {target_str}')
|
||||||
|
coverage_pass = False
|
||||||
continue
|
continue
|
||||||
if k in seq_to_filepath or k in non_vs_to_canonical:
|
if k in seq_to_filepath or k in non_vs_to_canonical:
|
||||||
alias_str = unicode_data.seq_to_string(k)
|
alias_str = unicode_data.seq_to_string(k)
|
||||||
target_str = unicode_data.seq_to_string(v)
|
target_str = unicode_data.seq_to_string(v)
|
||||||
print(f'coverage: alias {alias_str} already exists as {target_str} ({seq_name(v)})')
|
print(f'coverage: alias {alias_str} already exists as {target_str} ({seq_name(v)})')
|
||||||
|
coverage_pass = False
|
||||||
continue
|
continue
|
||||||
filename = seq_to_filepath.get(v) or seq_to_filepath[non_vs_to_canonical[v]]
|
filename = seq_to_filepath.get(v) or seq_to_filepath[non_vs_to_canonical[v]]
|
||||||
seq_to_filepath[k] = 'alias:' + filename
|
seq_to_filepath[k] = 'alias:' + filename
|
||||||
|
@ -272,12 +275,14 @@ def _check_coverage(seq_to_filepath, unicode_version):
|
||||||
if tuple([cp]) not in seq_to_filepath:
|
if tuple([cp]) not in seq_to_filepath:
|
||||||
print(
|
print(
|
||||||
f'coverage: missing single {cp} ({unicode_data.name(cp)})')
|
f'coverage: missing single {cp} ({unicode_data.name(cp)})')
|
||||||
|
coverage_pass = False
|
||||||
|
|
||||||
# special characters
|
# special characters
|
||||||
# all but combining enclosing keycap are currently marked as emoji
|
# all but combining enclosing keycap are currently marked as emoji
|
||||||
for cp in [ord('*'), ord('#'), ord(u'\u20e3')] + list(range(0x30, 0x3a)):
|
for cp in [ord('*'), ord('#'), ord(u'\u20e3')] + list(range(0x30, 0x3a)):
|
||||||
if cp not in emoji and tuple([cp]) not in seq_to_filepath:
|
if cp not in emoji and tuple([cp]) not in seq_to_filepath:
|
||||||
print(f'coverage: missing special {cp} ({unicode_data.name(cp)})')
|
print(f'coverage: missing special {cp} ({unicode_data.name(cp)})')
|
||||||
|
coverage_pass = False
|
||||||
|
|
||||||
# combining sequences
|
# combining sequences
|
||||||
comb_seq_to_name = sorted(
|
comb_seq_to_name = sorted(
|
||||||
|
@ -288,12 +293,17 @@ def _check_coverage(seq_to_filepath, unicode_version):
|
||||||
non_vs_seq = unicode_data.strip_emoji_vs(seq)
|
non_vs_seq = unicode_data.strip_emoji_vs(seq)
|
||||||
if non_vs_seq not in seq_to_filepath:
|
if non_vs_seq not in seq_to_filepath:
|
||||||
print(f'coverage: missing combining sequence {unicode_data.seq_to_string(seq)} ({name})')
|
print(f'coverage: missing combining sequence {unicode_data.seq_to_string(seq)} ({name})')
|
||||||
|
coverage_pass = False
|
||||||
|
|
||||||
# check for 'unknown flag'
|
# check for 'unknown flag'
|
||||||
# this is either emoji_ufe82b or 'unknown_flag', but we filter out things that
|
# this is either emoji_ufe82b or 'unknown_flag', but we filter out things that
|
||||||
# don't start with our prefix so 'unknown_flag' would be excluded by default.
|
# don't start with our prefix so 'unknown_flag' would be excluded by default.
|
||||||
if tuple([0xfe82b]) not in seq_to_filepath:
|
if tuple([0xfe82b]) not in seq_to_filepath:
|
||||||
print('coverage: missing unknown flag PUA fe82b')
|
print('coverage: missing unknown flag PUA fe82b')
|
||||||
|
coverage_pass = False
|
||||||
|
|
||||||
|
if not coverage_pass:
|
||||||
|
exit("Please fix the problems metioned above or run make without 'CHECK_SEQUENCE'")
|
||||||
|
|
||||||
|
|
||||||
def check_sequence_to_filepath(seq_to_filepath, unicode_version, coverage):
|
def check_sequence_to_filepath(seq_to_filepath, unicode_version, coverage):
|
||||||
|
|
Loading…
Add table
Reference in a new issue