From d270ecad996738be6f02069612cf7de665940969 Mon Sep 17 00:00:00 2001 From: Doug Felt Date: Fri, 3 Feb 2017 13:12:08 -0800 Subject: [PATCH] Generate unknown flag for unrecognized subregion emoji sequences. Instead of writing code to build the additional lookups needed for subregion missing flag handling, this adds a GSUB table to the template and lets add_glyphs do its normal thing to the first GSUB lookup. --- Makefile | 2 +- NotoColorEmoji.tmpl.ttx.tmpl | 316 ++++++++++++++++++++++++++ third_party/color_emoji/add_glyphs.py | 11 +- 3 files changed, 327 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2b0b35023..119383cc4 100644 --- a/Makefile +++ b/Makefile @@ -213,7 +213,7 @@ clean: rm -rf $(BUILD_DIR) .SECONDARY: $(EMOJI_FILES) $(FLAG_FILES) $(RESIZED_FLAG_FILES) $(RENAMED_FLAG_FILES) \ - $(ALL_QUANTIZED_FILES) $(ALL_COMPRESSED_FILES) + $(ALL_QUANTIZED_FILES) $(ALL_COMPRESSED_FILES) NotoColorEmoji.tmpl.ttx .PHONY: clean flags emoji renamed_flags quantized compressed check_compress_tool diff --git a/NotoColorEmoji.tmpl.ttx.tmpl b/NotoColorEmoji.tmpl.ttx.tmpl index e63c871d3..b4585df19 100644 --- a/NotoColorEmoji.tmpl.ttx.tmpl +++ b/NotoColorEmoji.tmpl.ttx.tmpl @@ -8,6 +8,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -127,6 +166,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -136,6 +214,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -199,4 +316,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/third_party/color_emoji/add_glyphs.py b/third_party/color_emoji/add_glyphs.py index c5bf6919e..f5f29080c 100644 --- a/third_party/color_emoji/add_glyphs.py +++ b/third_party/color_emoji/add_glyphs.py @@ -59,9 +59,18 @@ def add_ligature (font, seq, name): font['GSUB'] = add_emoji_gsub.create_simple_gsub([lookup]) else: lookup = font['GSUB'].table.LookupList.Lookup[0] - assert lookup.LookupType == 4 + # assert lookup.LookupType == 4 assert lookup.LookupFlag == 0 + # importXML doesn't fully init GSUB structures, so help it out + if not hasattr(lookup, 'LookupType'): + st = lookup.SubTable[0] + assert st.LookupType == 4 + setattr(lookup, 'LookupType', 4) + + if not hasattr(st, 'ligatures'): + setattr(st, 'ligatures', {}) + ligatures = lookup.SubTable[0].ligatures lig = otTables.Ligature()