Skip to content

Commit

Permalink
write_font_test: add failing test to demostrate issue374 still applie…
Browse files Browse the repository at this point in the history
…s for picosvg format

#324
  • Loading branch information
anthrotype committed Jan 27, 2022
1 parent 832f381 commit cc99744
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/emoji_u263a.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions tests/smiley_cheeks_gradient_svg.ttx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00">

<GlyphOrder>
<!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name=".space"/>
<GlyphID id="2" name="e000"/>
</GlyphOrder>

<hmtx>
<mtx name=".notdef" width="0" lsb="0"/>
<mtx name=".space" width="100" lsb="0"/>
<mtx name="e000" width="100" lsb="0"/>
</hmtx>

<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="0" platEncID="3" language="0">
<map code="0x20" name=".space"/><!-- SPACE -->
<map code="0xe000" name="e000"/><!-- ???? -->
</cmap_format_4>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x20" name=".space"/><!-- SPACE -->
<map code="0xe000" name="e000"/><!-- ???? -->
</cmap_format_4>
</cmap>

<loca>
<!-- The 'loca' table will be calculated by the compiler -->
</loca>

<glyf>

<!-- The xMin, yMin, xMax and yMax values
will be recalculated by the compiler. -->

<TTGlyph name=".notdef"/><!-- contains no outline data -->

<TTGlyph name=".space"/><!-- contains no outline data -->

<TTGlyph name="e000"/><!-- contains no outline data -->

</glyf>

<SVG>
<svgDoc endGlyphID="2" startGlyphID="2">
<![CDATA[<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<defs>
<path d="M44.75,69.83 A17.5 17.5 0 1 1 9.75,69.83 A17.5 17.5 0 1 1 44.75,69.83 Z" id="e000.0" fill="url(#g1)"/>
<radialGradient id="g1" cx="27.251" cy="73.507" r="19.038" gradientUnits="userSpaceOnUse" gradientTransform="matrix(1 0 0 0.95 0 0)">
<stop offset="0" stop-color="#ED7770" stop-opacity="0.8"/>
<stop offset="0.9" stop-color="#ED7770" stop-opacity="0"/>
</radialGradient>
</defs>
<g id="glyph2" transform="matrix(0.781 0 0 0.781 0 -100)">
<use xlink:href="#e000.0"/>
<use xlink:href="#e000.0" x="73.5"/>
</g>
</svg>
]]>
</svgDoc>
</SVG>

</ttFont>
9 changes: 9 additions & 0 deletions tests/write_font_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,15 @@ def test_vertical_metrics(ascender, descender, linegap):
"rect_sbix.ttx",
{"color_format": "sbix"},
),
# The cheeks on the similing face noto-emoji are two identical circles painted
# with same radial gradients, translated some units apart; check that after we
# re<use> the same path for both cheeks, their gradients still looks ok.
# https://github.com/googlefonts/nanoemoji/issues/324
(
("emoji_u263a.svg",),
"smiley_cheeks_gradient_svg.ttx",
{"color_format": "picosvg", "pretty_print": True},
),
],
)
def test_write_font_binary(svgs, expected_ttx, config_overrides):
Expand Down

0 comments on commit cc99744

Please sign in to comment.