From e571d53e0299bd1f9a7213424bc912289abb6837 Mon Sep 17 00:00:00 2001 From: Doug Felt Date: Wed, 9 May 2018 15:41:08 -0700 Subject: [PATCH] Some tooling updates for android u11. Note this does not change image files. - modify emoji_builder so we can use a flag to control whether to use big or small glyph metrics. android has legacy tooling that expects small metrics. we leave the default in emoji_builder to use big metrics but in the makefile default the flag we pass to request small metrics. eventually this should shake out to big metrics. - support more flags by default (not all yet). Note we omit some in the Makefile that we use aliases for-- we don't need their images. - add aliases for some new flags - remove new flags from 'unknown flag aliases' list - unalias some emoji we will have custom images for - bump version number - add annnotations file for u11 new and changed emoji --- Makefile | 20 +- NotoColorEmoji.tmpl.ttx.tmpl | 4 +- annotations_u11.txt | 260 +++++++++++++++++++++++ emoji_aliases.txt | 5 +- third_party/color_emoji/emoji_builder.py | 32 ++- unknown_flag_aliases.txt | 14 -- 6 files changed, 302 insertions(+), 33 deletions(-) create mode 100644 annotations_u11.txt diff --git a/Makefile b/Makefile index 048422bb2..b96286c4c 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,8 @@ ZOPFLIPNG = zopflipng OPTIPNG = optipng EMOJI_BUILDER = third_party/color_emoji/emoji_builder.py +# flag for emoji builder. Default to legacy small metrics for the time being. +SMALL_METRICS := -S ADD_GLYPHS = add_glyphs.py ADD_GLYPHS_FLAGS = -a emoji_aliases.txt PUA_ADDER = map_pua_emoji.py @@ -47,32 +49,34 @@ QUANTIZED_DIR := $(BUILD_DIR)/quantized_pngs COMPRESSED_DIR := $(BUILD_DIR)/compressed_pngs # Unknown flag is PUA fe82b +# Note, we omit some flags below that we support via aliasing instead. LIMITED_FLAGS = CN DE ES FR GB IT JP KR RU US SELECTED_FLAGS = AC AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ \ BA BB BD BE BF BG BH BI BJ BM BN BO BR BS BT BW BY BZ \ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ \ DE DJ DK DM DO DZ \ - EC EE EG ER ES ET EU \ - FI FJ FM FO FR \ - GA GB GD GE GG GH GI GL GM GN GQ GR GT GU GW GY \ + EC EE EG EH ER ES ET EU \ + FI FJ FK FM FO FR \ + GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY \ HK HN HR HT HU \ IC ID IE IL IM IN IO IQ IR IS IT \ JE JM JO JP \ KE KG KH KI KM KN KP KR KW KY KZ \ LA LB LC LI LK LR LS LT LU LV LY \ MA MC MD ME MG MH MK ML MM MN MO MP MR MS MT MU MV MW MX MY MZ \ - NA NE NF NG NI NL NO NP NR NU NZ \ + NA NC NE NF NG NI NL NO NP NR NU NZ \ OM \ - PA PE PF PG PH PK PL PN PR PS PT PW PY \ + PA PE PF PG PH PK PL PM PN PR PS PT PW PY \ QA \ RO RS RU RW \ SA SB SC SD SE SG SH SI SK SL SM SN SO SR SS ST SV SX SY SZ \ TA TC TD TG TH TJ TK TL TM TN TO TR TT TV TW TZ \ UA UG UN US UY UZ \ VA VC VE VG VI VN VU \ - WS \ - YE \ + WF WS \ + XK \ + YE YT \ ZA ZM ZW \ GB-ENG GB-SCT GB-WLS @@ -213,7 +217,7 @@ endif $(EMOJI).ttf: $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ $(ALL_COMPRESSED_FILES) | check_vs_adder - @python $(EMOJI_BUILDER) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" + @python $(EMOJI_BUILDER) $(SMALL_METRICS) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" @python $(PUA_ADDER) "$@" "$@-with-pua" @$(VS_ADDER) -vs 2640 2642 2695 --dstdir '.' -o "$@-with-pua-varsel" "$@-with-pua" @mv "$@-with-pua-varsel" "$@" diff --git a/NotoColorEmoji.tmpl.ttx.tmpl b/NotoColorEmoji.tmpl.ttx.tmpl index 170ad08c8..5ba20a7af 100644 --- a/NotoColorEmoji.tmpl.ttx.tmpl +++ b/NotoColorEmoji.tmpl.ttx.tmpl @@ -78,7 +78,7 @@ - + @@ -246,7 +246,7 @@ Noto Color Emoji - Version 2.011;GOOG;noto-emoji:20180424; pistol + Version 2.012;GOOG;noto-emoji:20180508:beta NotoColorEmoji diff --git a/annotations_u11.txt b/annotations_u11.txt new file mode 100644 index 000000000..739d847c0 --- /dev/null +++ b/annotations_u11.txt @@ -0,0 +1,260 @@ +# new unicode 11 emoji +# generated using unicode_data and alpha UCD11 data. +# emoji sort order +annotation: ok +1f970 # smiling face with 3 hearts +1f975 # hot face +1f976 # cold face +1f973 # partying face +1f974 # woozy face +1f97a # pleading face +1f468 200d 1f9b0 # man, red haired +1f468 1f3fb 200d 1f9b0 # man, red haired: light skin tone +1f468 1f3fc 200d 1f9b0 # man, red haired: medium-light skin tone +1f468 1f3fd 200d 1f9b0 # man, red haired: medium skin tone +1f468 1f3fe 200d 1f9b0 # man, red haired: medium-dark skin tone +1f468 1f3ff 200d 1f9b0 # man, red haired: dark skin tone +1f469 200d 1f9b0 # woman, red haired +1f469 1f3fb 200d 1f9b0 # woman, red haired: light skin tone +1f469 1f3fc 200d 1f9b0 # woman, red haired: medium-light skin tone +1f469 1f3fd 200d 1f9b0 # woman, red haired: medium skin tone +1f469 1f3fe 200d 1f9b0 # woman, red haired: medium-dark skin tone +1f469 1f3ff 200d 1f9b0 # woman, red haired: dark skin tone +1f468 200d 1f9b1 # man, curly haired +1f468 1f3fb 200d 1f9b1 # man, curly haired: light skin tone +1f468 1f3fc 200d 1f9b1 # man, curly haired: medium-light skin tone +1f468 1f3fd 200d 1f9b1 # man, curly haired: medium skin tone +1f468 1f3fe 200d 1f9b1 # man, curly haired: medium-dark skin tone +1f468 1f3ff 200d 1f9b1 # man, curly haired: dark skin tone +1f469 200d 1f9b1 # woman, curly haired +1f469 1f3fb 200d 1f9b1 # woman, curly haired: light skin tone +1f469 1f3fc 200d 1f9b1 # woman, curly haired: medium-light skin tone +1f469 1f3fd 200d 1f9b1 # woman, curly haired: medium skin tone +1f469 1f3fe 200d 1f9b1 # woman, curly haired: medium-dark skin tone +1f469 1f3ff 200d 1f9b1 # woman, curly haired: dark skin tone +1f468 200d 1f9b2 # man, bald +1f468 1f3fb 200d 1f9b2 # man, bald: light skin tone +1f468 1f3fc 200d 1f9b2 # man, bald: medium-light skin tone +1f468 1f3fd 200d 1f9b2 # man, bald: medium skin tone +1f468 1f3fe 200d 1f9b2 # man, bald: medium-dark skin tone +1f468 1f3ff 200d 1f9b2 # man, bald: dark skin tone +1f469 200d 1f9b2 # woman, bald +1f469 1f3fb 200d 1f9b2 # woman, bald: light skin tone +1f469 1f3fc 200d 1f9b2 # woman, bald: medium-light skin tone +1f469 1f3fd 200d 1f9b2 # woman, bald: medium skin tone +1f469 1f3fe 200d 1f9b2 # woman, bald: medium-dark skin tone +1f469 1f3ff 200d 1f9b2 # woman, bald: dark skin tone +1f468 200d 1f9b3 # man, white haired +1f468 1f3fb 200d 1f9b3 # man, white haired: light skin tone +1f468 1f3fc 200d 1f9b3 # man, white haired: medium-light skin tone +1f468 1f3fd 200d 1f9b3 # man, white haired: medium skin tone +1f468 1f3fe 200d 1f9b3 # man, white haired: medium-dark skin tone +1f468 1f3ff 200d 1f9b3 # man, white haired: dark skin tone +1f469 200d 1f9b3 # woman, white haired +1f469 1f3fb 200d 1f9b3 # woman, white haired: light skin tone +1f469 1f3fc 200d 1f9b3 # woman, white haired: medium-light skin tone +1f469 1f3fd 200d 1f9b3 # woman, white haired: medium skin tone +1f469 1f3fe 200d 1f9b3 # woman, white haired: medium-dark skin tone +1f469 1f3ff 200d 1f9b3 # woman, white haired: dark skin tone +1f9b8 # superhero +1f9b8 1f3fb # superhero: light skin tone +1f9b8 1f3fc # superhero: medium-light skin tone +1f9b8 1f3fd # superhero: medium skin tone +1f9b8 1f3fe # superhero: medium-dark skin tone +1f9b8 1f3ff # superhero: dark skin tone +1f9b8 200d 2640 fe0f # woman superhero +1f9b8 1f3fb 200d 2640 fe0f # woman superhero: light skin tone +1f9b8 1f3fc 200d 2640 fe0f # woman superhero: medium-light skin tone +1f9b8 1f3fd 200d 2640 fe0f # woman superhero: medium skin tone +1f9b8 1f3fe 200d 2640 fe0f # woman superhero: medium-dark skin tone +1f9b8 1f3ff 200d 2640 fe0f # woman superhero: dark skin tone +1f9b8 200d 2642 fe0f # man superhero +1f9b8 1f3fb 200d 2642 fe0f # man superhero: light skin tone +1f9b8 1f3fc 200d 2642 fe0f # man superhero: medium-light skin tone +1f9b8 1f3fd 200d 2642 fe0f # man superhero: medium skin tone +1f9b8 1f3fe 200d 2642 fe0f # man superhero: medium-dark skin tone +1f9b8 1f3ff 200d 2642 fe0f # man superhero: dark skin tone +1f9b9 # supervillain +1f9b9 1f3fb # supervillain: light skin tone +1f9b9 1f3fc # supervillain: medium-light skin tone +1f9b9 1f3fd # supervillain: medium skin tone +1f9b9 1f3fe # supervillain: medium-dark skin tone +1f9b9 1f3ff # supervillain: dark skin tone +1f9b9 200d 2640 fe0f # woman supervillain +1f9b9 1f3fb 200d 2640 fe0f # woman supervillain: light skin tone +1f9b9 1f3fc 200d 2640 fe0f # woman supervillain: medium-light skin tone +1f9b9 1f3fd 200d 2640 fe0f # woman supervillain: medium skin tone +1f9b9 1f3fe 200d 2640 fe0f # woman supervillain: medium-dark skin tone +1f9b9 1f3ff 200d 2640 fe0f # woman supervillain: dark skin tone +1f9b9 200d 2642 fe0f # man supervillain +1f9b9 1f3fb 200d 2642 fe0f # man supervillain: light skin tone +1f9b9 1f3fc 200d 2642 fe0f # man supervillain: medium-light skin tone +1f9b9 1f3fd 200d 2642 fe0f # man supervillain: medium skin tone +1f9b9 1f3fe 200d 2642 fe0f # man supervillain: medium-dark skin tone +1f9b9 1f3ff 200d 2642 fe0f # man supervillain: dark skin tone +1f9b5 # leg +1f9b5 1f3fb # leg: light skin tone +1f9b5 1f3fc # leg: medium-light skin tone +1f9b5 1f3fd # leg: medium skin tone +1f9b5 1f3fe # leg: medium-dark skin tone +1f9b5 1f3ff # leg: dark skin tone +1f9b6 # foot +1f9b6 1f3fb # foot: light skin tone +1f9b6 1f3fc # foot: medium-light skin tone +1f9b6 1f3fd # foot: medium skin tone +1f9b6 1f3fe # foot: medium-dark skin tone +1f9b6 1f3ff # foot: dark skin tone +1f9b0 # red-haired +1f9b1 # curly-haired +1f9b2 # bald +1f9b3 # white-haired +1f9b4 # bone +1f9b7 # tooth +1f97d # goggles +1f97c # lab coat +1f97e # hiking boot +1f97f # woman’s flat shoe +1f99d # raccoon +1f999 # llama +1f99b # hippopotamus +1f998 # kangaroo +1f9a1 # badger +1f9a2 # swan +1f99a # peacock +1f99c # parrot +1f99e # lobster +1f99f # mosquito +1f9a0 # microbe +1f96d # mango +1f96c # leafy green +1f96f # bagel +1f9c2 # salt +1f96e # moon cake +1f9c1 # cupcake +1f9ed # compass +1f9f1 # bricks +1f6f9 # skateboard +1f9f3 # luggage +1f9e8 # firecracker +1f9e7 # red envelope +1f94e # softball +1f94f # flying disc +1f94d # lacrosse +1f9ff # nazar amulet +1f9e9 # jigsaw +1f9f8 # teddy bear +1f9f5 # thread +1f9f6 # yarn +1f9ee # abacus +1f9fe # receipt +1f9f0 # toolbox +1f9f2 # magnet +1f9ea # test tube +1f9eb # petri dish +1f9ec # dna +1f9f4 # lotion bottle +1f9f7 # safety pin +1f9f9 # broom +1f9fa # basket +1f9fb # roll of paper +1f9fc # soap +1f9fd # sponge +1f9ef # fire extinguisher + +# bugfixes, codepoint order +annotation: warning +0023 +002a +0030 +0031 +0032 +0033 +0034 +0035 +0036 +0037 +0038 +0039 +1f311 +1f312 +1f313 +1f314 +1f315 +1f316 +1f317 +1f318 +1f319 +# 1f31a # new moon face +1f31b +1f31c +# 1f31d # full moon face +# 1f31e # sun with face +1f3bb +1f3e5 +1f3f9 +1f410 +1f415 +# 1f41d # honeybee +1f422 +1f42a +1f42b +1f436 +1f46a +1f482 1f3fb 200d 2640 +1f482 1f3fb 200d 2642 +1f482 1f3fc 200d 2640 +1f482 1f3fc 200d 2642 +1f482 1f3fd 200d 2640 +1f482 1f3fd 200d 2642 +1f482 1f3fe 200d 2640 +1f482 1f3fe 200d 2642 +1f482 1f3ff 200d 2640 +1f482 1f3ff 200d 2642 +1f482 200d 2640 +1f482 200d 2642 +1f491 +1f4a3 +1f4be +1f52a +1f52b +1f5e1 +1f643 +1f691 +1f699 +1f925 +1f92a +# 1f939 200d 2642 # man juggling +1f94c +1f953 +1f957 +1f992 +1f997 +1f9c0 +1f9d9 1f3fd 200d 2640 +2139 +2694 + +annotation: ok +# 'new' in that they now have emoji presentation +265f # chess pawn +267e # infinity + +# I believe this is new but u11 emoji-zwj-sequences.txt lists this as 7.0 +1f3f4 200d 2620 # pirate flag + +# flags +annotation: ok +1f1e9 1f1ec # DG -- alias IO +1f1ea 1f1e6 # EA -- alias ES +1f1ea 1f1ed # EH +1f1eb 1f1f0 # FK +1f1ec 1f1eb # GF +1f1ec 1f1f5 # GP +1f1ec 1f1f8 # GS +1f1f2 1f1eb # MF -- alias FR +1f1f3 1f1e8 # NC +1f1f5 1f1f2 # PM +1f1fc 1f1eb # WF +1f1fd 1f1f0 # XK +1f1fe 1f1f9 # YT + diff --git a/emoji_aliases.txt b/emoji_aliases.txt index b1a9e7554..47dbbae14 100644 --- a/emoji_aliases.txt +++ b/emoji_aliases.txt @@ -32,7 +32,6 @@ 1f3cc_1f3fd;1f3cc_1f3fd_200d_2642 # medium skin tone 1f3cc_1f3fe;1f3cc_1f3fe_200d_2642 # medium-dark skin tone 1f3cc_1f3ff;1f3cc_1f3ff_200d_2642 # dark skin tone -1f46a;1f468_200d_1f469_200d_1f466 # FAMILY -> family: man, woman, boy 1f46e;1f46e_200d_2642 # POLICE OFFICER -> man police officer 1f46e_1f3fb;1f46e_1f3fb_200d_2642 # light skin tone 1f46e_1f3fc;1f46e_1f3fc_200d_2642 # medium-light skin tone @@ -83,7 +82,6 @@ 1f487_1f3fe;1f487_1f3fe_200d_2640 # medium-dark skin tone 1f487_1f3ff;1f487_1f3ff_200d_2640 # dark skin tone 1f48f;1f469_200d_2764_200d_1f48b_200d_1f468 # KISS -> kiss: woman, man -1f491;1f469_200d_2764_200d_1f468 # COUPLE WITH HEART -> couple with heart: woman, man 1f575;1f575_200d_2642 # SLEUTH OR SPY -> man detective 1f575_1f3fb;1f575_1f3fb_200d_2642 # light skin tone 1f575_1f3fc;1f575_1f3fc_200d_2642 # medium-light skin tone @@ -198,7 +196,10 @@ fe82b;unknown_flag # no name -> no name # flag aliases 1f1e7_1f1fb;1f1f3_1f1f4 # BV -> NO 1f1e8_1f1f5;1f1eb_1f1f7 # CP -> FR +1f1e9_1f1ec;1f1ee_1f1f4 # DG -> IO +1f1ea_1f1e6;1f1ea_1f1f8 # EA -> ES 1f1ed_1f1f2;1f1e6_1f1fa # HM -> AU +1f1f2_1f1eb;1f1eb_1f1f7 # MF -> FR 1f1f8_1f1ef;1f1f3_1f1f4 # SJ -> NO 1f1fa_1f1f2;1f1fa_1f1f8 # UM -> US diff --git a/third_party/color_emoji/emoji_builder.py b/third_party/color_emoji/emoji_builder.py index 5db9b56d8..4157807e8 100644 --- a/third_party/color_emoji/emoji_builder.py +++ b/third_party/color_emoji/emoji_builder.py @@ -100,7 +100,7 @@ class CBDT: del self.strike_metrics return glyph_maps - def write_bigGlyphMetrics (self, width, height): + def write_glyphMetrics (self, width, height, big_metrics): ascent = self.font_metrics.ascent descent = self.font_metrics.descent @@ -122,23 +122,30 @@ class CBDT: vert_advance = height # print "big glyph metrics h: %d w: %d" % (height, width) - # bigGlyphMetrics + # smallGlyphMetrics # Type Name # BYTE height # BYTE width # CHAR horiBearingX # CHAR horiBearingY # BYTE horiAdvance + # add for bigGlyphMetrics: # CHAR vertBearingX # CHAR vertBearingY # BYTE vertAdvance try: + if big_metrics: self.write (struct.pack ("BBbbBbbB", height, width, x_bearing, y_bearing, advance, vert_x_bearing, vert_y_bearing, vert_advance)) + else: + self.write (struct.pack ("BBbbB", + height, width, + x_bearing, y_bearing, + advance)) except Exception as e: raise ValueError("%s, h: %d w: %d x: %d y: %d %d a:" % ( e, height, width, x_bearing, y_bearing, advance)) @@ -174,14 +181,19 @@ class CBDT: png_allowed_chunks = ["IHDR", "PLTE", "tRNS", "sRGB", "IDAT", "IEND"] - def write_format18 (self, png): + def write_format17 (self, png): + self.write_format17or18(png, False) + def write_format18 (self, png): + self.write_format17or18(png, True) + + def write_format17or18 (self, png, big_metrics): width, height = png.get_size () if 'keep_chunks' not in self.options: png = png.filter_chunks (self.png_allowed_chunks) - self.write_bigGlyphMetrics (width, height) + self.write_glyphMetrics (width, height, big_metrics) png_data = png.data () # ULONG data length @@ -190,6 +202,7 @@ class CBDT: def image_write_func (self, image_format): if image_format == 1: return self.write_format1 + if image_format == 17: return self.write_format17 if image_format == 18: return self.write_format18 return None @@ -376,6 +389,7 @@ def main (argv): "-V": "verbose", "-O": "keep_outlines", "-U": "uncompressed", + "-S": "small_glyph_metrics", "-C": "keep_chunks", } @@ -388,7 +402,7 @@ def main (argv): print(""" Usage: -emoji_builder.py [-V] [-O] [-U] [-A] font.ttf out-font.ttf strike-prefix... +emoji_builder.py [-V] [-O] [-U] [-S] [-A] font.ttf out-font.ttf strike-prefix... This will search for files that have strike-prefix followed by a hex number, and end in ".png". For example, if strike-prefix @@ -405,7 +419,10 @@ that the font already supports, and writes the new font out. If -V is given, verbose mode is enabled. If -U is given, uncompressed images are stored (imageFormat=1). -By default, PNG images are stored (imageFormat=18). + +If -S is given, PNG images are stored with small glyph metrics (imageFormat=17). + +By default, PNG images are stored with big glyph metrics (imageFormat=18). If -O is given, the outline tables ('glyf', 'CFF ') and related tables are NOT dropped from the font. @@ -452,7 +469,8 @@ By default they are dropped. if not unicode_cmap: raise Exception ("Failed to find a Unicode cmap.") - image_format = 1 if 'uncompressed' in options else 18 + image_format = 1 if 'uncompressed' in options else (17 + if 'small_glyph_metrics' in options else 18) ebdt = CBDT (font_metrics, options) ebdt.write_header () diff --git a/unknown_flag_aliases.txt b/unknown_flag_aliases.txt index 3708463ab..4f7424274 100644 --- a/unknown_flag_aliases.txt +++ b/unknown_flag_aliases.txt @@ -6,20 +6,6 @@ # flag aliases 1f1e7_1f1f1;fe82b # BL 1f1e7_1f1f6;fe82b # BQ -1f1e9_1f1ec;fe82b # DG -1f1ea_1f1e6;fe82b # EA -1f1ea_1f1ed;fe82b # EH -1f1eb_1f1f0;fe82b # FK -1f1ec_1f1eb;fe82b # GF -1f1ec_1f1f5;fe82b # GP -1f1ec_1f1f8;fe82b # GS -1f1f2_1f1eb;fe82b # MF 1f1f2_1f1f6;fe82b # MQ -1f1f3_1f1e8;fe82b # NC -1f1f5_1f1f2;fe82b # PM 1f1f7_1f1ea;fe82b # RE 1f1f9_1f1eb;fe82b # TF -1f1fc_1f1eb;fe82b # WF -1f1fd_1f1f0;fe82b # XK -1f1fe_1f1f9;fe82b # YT -