summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiyamed Sinir <siyamed@google.com>2018-04-12 13:11:42 -0700
committerSiyamed Sinir <siyamed@google.com>2018-04-19 12:10:16 -0700
commitd97df5a2803f1e87ed6c129d57e9d6109e6d1040 (patch)
tree80196a23875bb75357dba4ecb008d9a07e35438c
parent3f8884829f6dcea454a74c6cf18e4bd89cf70acc (diff)
Update fontchain_linter for emoji 11
* Add default genders for super villain and super hero. * Read capability to read from emoji exclusions file. * Update lint rule to use different glyphs for couple with heart. Test: m fontchain_lint Test: Visual test with a build and sample app Bug: 77148691 Change-Id: Icd92f0455709625b3998fc8eef1d448e17a5d71f Merged-In: Icd92f0455709625b3998fc8eef1d448e17a5d71f Merged-In: I56dd3c1e1258bab2fcbdf42e5c42587e45dd92fe (cherry picked from commit e853efc0817ef38f6ba561ea768d49caf1e53dba)
-rwxr-xr-xtools/fonts/fontchain_linter.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/fonts/fontchain_linter.py b/tools/fonts/fontchain_linter.py
index ec40a2229c33..ffca46696a7c 100755
--- a/tools/fonts/fontchain_linter.py
+++ b/tools/fonts/fontchain_linter.py
@@ -471,11 +471,20 @@ def parse_ucd(ucd_path):
_emoji_zwj_sequences.update(parse_unicode_datafile(
path.join(ucd_path, 'additions', 'emoji-zwj-sequences.txt')))
+ exclusions = parse_unicode_datafile(path.join(ucd_path, 'additions', 'emoji-exclusions.txt'))
+ _emoji_sequences = remove_emoji_exclude(_emoji_sequences, exclusions)
+ _emoji_zwj_sequences = remove_emoji_exclude(_emoji_zwj_sequences, exclusions)
+ _emoji_variation_sequences = remove_emoji_variation_exclude(_emoji_variation_sequences, exclusions)
+
+def remove_emoji_variation_exclude(source, items):
+ return source.difference(items.keys())
+
+def remove_emoji_exclude(source, items):
+ return {k: v for k, v in source.items() if k not in items}
def flag_sequence(territory_code):
return tuple(0x1F1E6 + ord(ch) - ord('A') for ch in territory_code)
-
UNSUPPORTED_FLAGS = frozenset({
flag_sequence('BL'), flag_sequence('BQ'), flag_sequence('DG'),
flag_sequence('EA'), flag_sequence('EH'), flag_sequence('FK'),
@@ -522,8 +531,6 @@ LEGACY_ANDROID_EMOJI = {
ZWJ_IDENTICALS = {
# KISS
(0x1F469, 0x200D, 0x2764, 0x200D, 0x1F48B, 0x200D, 0x1F468): 0x1F48F,
- # COUPLE WITH HEART
- (0x1F469, 0x200D, 0x2764, 0x200D, 0x1F468): 0x1F491,
# FAMILY
(0x1F468, 0x200D, 0x1F469, 0x200D, 0x1F466): 0x1F46A,
}
@@ -576,6 +583,8 @@ GENDER_DEFAULTS = [
(0x1F9DD, FEMALE_SIGN), # ELF
(0x1F9DE, FEMALE_SIGN), # GENIE
(0x1F9DF, FEMALE_SIGN), # ZOMBIE
+ (0X1F9B8, FEMALE_SIGN), # SUPERVILLAIN
+ (0x1F9B9, FEMALE_SIGN), # SUPERHERO
]
def is_fitzpatrick_modifier(cp):