From be1ec4f152443e4eea1eeddae78834354008beb0 Mon Sep 17 00:00:00 2001 From: Doug Felt Date: Mon, 11 Jul 2016 11:31:51 -0700 Subject: [PATCH 1/2] Update handling of fitzpatrick modifiers. To handle forming emoji 'ligatures' in RTL contexts we generate reversed ligature sequences for the GSUB table. Formerly we only did this when there was a ZWJ in the sequence, and full reversal worked because we had no sequences with both fitzpatrick modifiers and ZWJ. However, now we do. Harfbuzz treats fitzpatrick modifiers as though they were combining marks and so we need to as well so that GSUB data is in the order Harfbuzz expects. So we 'unreverse' these pairs. --- third_party/color_emoji/add_glyphs.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/third_party/color_emoji/add_glyphs.py b/third_party/color_emoji/add_glyphs.py index 7f7b4f8cd..b653f30a7 100644 --- a/third_party/color_emoji/add_glyphs.py +++ b/third_party/color_emoji/add_glyphs.py @@ -17,6 +17,10 @@ import add_emoji_gsub def is_vs(cp): return cp >= 0xfe00 and cp <= 0xfe0f +def is_fitzpatrick(gname): + cp = int(gname[1:], 16) + return 0x1f3fb <= cp <= 0x1f3ff + def codes_to_string(codes): if "_" in codes: pieces = codes.split ("_") @@ -147,10 +151,19 @@ glyph_names = set() ligatures = {} def add_lig_sequence(ligatures, seq, n): - # Assume sequences with ZWJ are emoji 'ligatures' and rtl order - # is also valid. Internal permutations, though, no. - # We associate a sequence with a filename. We can overwrite the - # sequence with a different filename later. + # We have emoji sequences using regional indicator symbols, + # ZWJ, fitzpatrick modifiers, and combinations of ZWJ and fitzpatrick + # modifiers. Currently, Harfbuzz special-cases the fitzpatrick + # modifiers to treat them as combining marks instead of as Other + # Neutral, which unicode says they are, and processes them + # in visual order (at least in some circumstances). So to handle + # emoji sequences in an RTL context we need GSUB sequences that match + # this order. + # Regional indicator symbols are LTR, and emoji+fitzpatrick are + # effectively LTR, so we only reorder sequences with ZWJ. If however + # the ZWJ sequence has fitzpatrick modifiers, those need to still follow + # the emoji they logically follow, so simply reversing the sequence + # doesn't work. This code assumes the lig sequence is valid. tseq = tuple(seq) if tseq in ligatures: print 'lig sequence %s, replace %s with %s' % ( @@ -159,6 +172,12 @@ def add_lig_sequence(ligatures, seq, n): if 'u200D' in seq: rev_seq = seq[:] rev_seq.reverse() + for i in xrange(1, len(rev_seq)): + if is_fitzpatrick(rev_seq[i - 1]): + tmp = rev_seq[i] + rev_seq[i] = rev_seq[i-1] + rev_seq[i-1] = tmp + trseq = tuple(rev_seq) # if trseq in ligatures: # print 'rev lig sequence %s, replace %s with %s' % ( From e16b39e492f6d39a783932f76d05662a081fa79a Mon Sep 17 00:00:00 2001 From: Doug Felt Date: Wed, 13 Jul 2016 11:36:25 -0700 Subject: [PATCH 2/2] Bump version, specify additional chars in varsel cmap. The additional variation chars option makes it easier to build prototype versions of the emoji font. --- Makefile | 2 +- NotoColorEmoji.tmpl.ttx.tmpl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cbdd6ffa1..3d1e3529c 100644 --- a/Makefile +++ b/Makefile @@ -201,7 +201,7 @@ $(EMOJI).ttf: $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ $(ALL_COMPRESSED_FILES) | check_vs_adder @python $(EMOJI_BUILDER) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" @python $(PUA_ADDER) "$@" "$@-with-pua" - $(VS_ADDER) --dstdir '.' -o "$@-with-pua-varsel" "$@-with-pua" + $(VS_ADDER) -vs 2640 2642 2695 --dstdir '.' -o "$@-with-pua-varsel" "$@-with-pua" mv "$@-with-pua-varsel" "$@" rm "$@-with-pua" diff --git a/NotoColorEmoji.tmpl.ttx.tmpl b/NotoColorEmoji.tmpl.ttx.tmpl index 6fefe984c..817e18191 100644 --- a/NotoColorEmoji.tmpl.ttx.tmpl +++ b/NotoColorEmoji.tmpl.ttx.tmpl @@ -13,7 +13,7 @@ - + @@ -156,7 +156,7 @@ Noto Color Emoji - Version 1.32 + Version 1.33 NotoColorEmoji