diff --git a/src/nanoemoji/write_font.py b/src/nanoemoji/write_font.py index 044bad98..c97f9c74 100644 --- a/src/nanoemoji/write_font.py +++ b/src/nanoemoji/write_font.py @@ -696,8 +696,9 @@ def _picosvg_and_cbdt( ): picosvg = True compressed = False - make_cbdt_table(config, ttfont, color_glyphs) + # make the svg table first because it changes glyph order and cbdt cares make_svg_table(config, ttfont, color_glyphs, picosvg, compressed) + make_cbdt_table(config, ttfont, color_glyphs) def _ensure_codepoints_will_have_glyphs(ufo, glyph_inputs): diff --git a/tests/compat_font/config.toml b/tests/compat_font/config.toml new file mode 100644 index 00000000..fc990547 --- /dev/null +++ b/tests/compat_font/config.toml @@ -0,0 +1,17 @@ +family = "Noto Color Emoji Compat Test" +output_file = "Font.ttf" +color_format = "glyf_colr_1_and_picosvg_and_cbdt" + +[axis.wght] +name = "Weight" +default = 400 + +[master.regular] +style_name = "Regular" +srcs = [ + "emoji_u0023.svg", + "emoji_u1f1e6_1f1e8.svg", +] + +[master.regular.position] +wght = 400 diff --git a/tests/compat_font/emoji_u0023.svg b/tests/compat_font/emoji_u0023.svg new file mode 100644 index 00000000..174daa86 --- /dev/null +++ b/tests/compat_font/emoji_u0023.svg @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tests/compat_font/emoji_u1f1e6_1f1e8.svg b/tests/compat_font/emoji_u1f1e6_1f1e8.svg new file mode 100644 index 00000000..174daa86 --- /dev/null +++ b/tests/compat_font/emoji_u1f1e6_1f1e8.svg @@ -0,0 +1,8 @@ + + + + + + + diff --git a/tests/nanoemoji_test.py b/tests/nanoemoji_test.py index be6efcc8..03782fe8 100644 --- a/tests/nanoemoji_test.py +++ b/tests/nanoemoji_test.py @@ -199,15 +199,17 @@ def test_build_cbdt_font(): assert "CBLC" in font +@pytest.mark.parametrize( + "config_file", + [ + "minimal_static/config_glyf_colr_1_and_picosvg_and_cbdt.toml", + # https://github.com/googlefonts/nanoemoji/issues/385 + "compat_font/config.toml", + ], +) @pytest.mark.skipif(RESVG_PATH is None, reason="resvg not installed") -def test_build_glyf_colr_1_and_picosvg_and_cbdt_font(): - tmp_dir = _run( - ( - locate_test_file( - "minimal_static/config_glyf_colr_1_and_picosvg_and_cbdt.toml" - ), - ) - ) +def test_build_compat_font(config_file): + tmp_dir = _run((locate_test_file(config_file),)) font = TTFont(tmp_dir / "Font.ttf")