From 0790ac68bcab55905b492f6542d2393310f14ea3 Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Tue, 9 Aug 2016 14:28:54 -0700 Subject: [PATCH] Update lint check to accommodate new emoji sequences These are not yet ready for updating in the unicode data, so we patch them in code until they are. Bug: 30594617 Change-Id: Ib4c8568aa4840341474eb0c0c95674d640473f4d (cherry picked from commit 2b8b819fee939c1bca6347a74b42272bc7008fd5) --- tools/fonts/fontchain_lint.py | 36 ++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/tools/fonts/fontchain_lint.py b/tools/fonts/fontchain_lint.py index 336fce96650ff..7ec46a3ee86b9 100755 --- a/tools/fonts/fontchain_lint.py +++ b/tools/fonts/fontchain_lint.py @@ -507,12 +507,46 @@ def compute_expected_emoji(): all_sequences = set() all_sequences.update(_emoji_variation_sequences) + # add zwj sequences not in the current emoji-zwj-sequences.txt + adjusted_emoji_zwj_sequences = dict(_emoji_zwj_sequences) + adjusted_emoji_zwj_sequences.update(_emoji_zwj_sequences) + # single parent families + additional_emoji_zwj = ( + (0x1F468, 0x200D, 0x1F466), + (0x1F468, 0x200D, 0x1F467), + (0x1F468, 0x200D, 0x1F466, 0x200D, 0x1F466), + (0x1F468, 0x200D, 0x1F467, 0x200D, 0x1F466), + (0x1F468, 0x200D, 0x1F467, 0x200D, 0x1F467), + (0x1F469, 0x200D, 0x1F466), + (0x1F469, 0x200D, 0x1F467), + (0x1F469, 0x200D, 0x1F466, 0x200D, 0x1F466), + (0x1F469, 0x200D, 0x1F467, 0x200D, 0x1F466), + (0x1F469, 0x200D, 0x1F467, 0x200D, 0x1F467), + ) + # sequences formed from man and woman and optional fitzpatrick modifier + modified_extensions = ( + 0x2696, + 0x2708, + 0x1F3A8, + 0x1F680, + 0x1F692, + ) + for seq in additional_emoji_zwj: + adjusted_emoji_zwj_sequences[seq] = 'Emoji_ZWJ_Sequence' + for ext in modified_extensions: + for base in (0x1F468, 0x1F469): + seq = (base, 0x200D, ext) + adjusted_emoji_zwj_sequences[seq] = 'Emoji_ZWJ_Sequence' + for modifier in range(0x1F3FB, 0x1F400): + seq = (base, modifier, 0x200D, ext) + adjusted_emoji_zwj_sequences[seq] = 'Emoji_ZWJ_Sequence' + for sequence in _emoji_sequences.keys(): sequence = tuple(ch for ch in sequence if ch != EMOJI_VS) all_sequences.add(sequence) sequence_pieces.update(sequence) - for sequence in _emoji_zwj_sequences.keys(): + for sequence in adjusted_emoji_zwj_sequences.keys(): sequence = tuple(ch for ch in sequence if ch != EMOJI_VS) all_sequences.add(sequence) sequence_pieces.update(sequence)