From 1f6fbdd7a40fc5d51d182b565dc1a4632be54937 Mon Sep 17 00:00:00 2001 From: Roel Nieskens Date: Tue, 10 Sep 2019 13:59:38 +0200 Subject: [PATCH] Remove unnecessary TTX compile step Use .ttx as input for emoji_builder.py Originally the .ttx generated by add_glyphs.py was compiled to a .ttf file so it could be fed to emoji_builder.py. Now we can feed it a .ttx file and remove the compile step. This way the original glyph names are preserved and we can start adding PNGs for the components. --- Makefile | 6 +----- third_party/color_emoji/emoji_builder.py | 6 +++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e8d53b5a4..ec05f5491 100644 --- a/Makefile +++ b/Makefile @@ -209,11 +209,7 @@ endif %.ttx: %.ttx.tmpl $(ADD_GLYPHS) $(ALL_COMPRESSED_FILES) @python $(ADD_GLYPHS) -f "$<" -o "$@" -d "$(COMPRESSED_DIR)" $(ADD_GLYPHS_FLAGS) -%.ttf: %.ttx - @rm -f "$@" - ttx "$<" - -$(EMOJI).ttf: $(EMOJI).tmpl.ttf $(EMOJI_BUILDER) $(PUA_ADDER) \ +$(EMOJI).ttf: $(EMOJI).tmpl.ttx $(EMOJI_BUILDER) $(PUA_ADDER) \ $(ALL_COMPRESSED_FILES) | check_vs_adder @python $(EMOJI_BUILDER) $(SMALL_METRICS) -V $< "$@" "$(COMPRESSED_DIR)/emoji_u" @python $(PUA_ADDER) "$@" "$@-with-pua" diff --git a/third_party/color_emoji/emoji_builder.py b/third_party/color_emoji/emoji_builder.py index 278dd2bc0..2f4d5762d 100644 --- a/third_party/color_emoji/emoji_builder.py +++ b/third_party/color_emoji/emoji_builder.py @@ -475,7 +475,11 @@ By default they are dropped. print() - font = ttx.TTFont(font_file) + if font_file.endswith(".ttx"): + font = ttx.TTFont() + font.importXML(font_file) + else: + font = ttx.TTFont(font_file) print("Loaded font '%s'." % font_file) font_metrics = FontMetrics(font['head'].unitsPerEm, font['hhea'].ascent,