Skip to content

Commit

Permalink
Merge pull request #387 from googlefonts/i385
Browse files Browse the repository at this point in the history
Compat font doesn't build
  • Loading branch information
anthrotype authored Feb 22, 2022
2 parents cba0561 + b338bd7 commit a3c54d8
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/nanoemoji/write_font.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
17 changes: 17 additions & 0 deletions tests/compat_font/config.toml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions tests/compat_font/emoji_u0023.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions tests/compat_font/emoji_u1f1e6_1f1e8.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 10 additions & 8 deletions tests/nanoemoji_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit a3c54d8

Please sign in to comment.