Skip to content

Commit

Permalink
add test case for issue 287
Browse files Browse the repository at this point in the history
paths extracted from Noto Emoji EU.svg waved flag.
  • Loading branch information
anthrotype committed May 14, 2021
1 parent 9a11597 commit f6ca23b
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/transformed_components_overlap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
159 changes: 159 additions & 0 deletions tests/transformed_components_overlap.ttx
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?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"/>
<GlyphID id="3" name="e000.0"/>
<GlyphID id="4" name="e000.1"/>
<GlyphID id="5" name="e000.2"/>
<GlyphID id="6" name="e000.3"/>
</GlyphOrder>

<hmtx>
<mtx name=".notdef" width="0" lsb="0"/>
<mtx name=".space" width="100" lsb="0"/>
<mtx name="e000" width="100" lsb="38"/>
<mtx name="e000.0" width="100" lsb="38"/>
<mtx name="e000.1" width="100" lsb="38"/>
<mtx name="e000.2" width="100" lsb="38"/>
<mtx name="e000.3" width="100" lsb="38"/>
</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" xMin="38" yMin="34" xMax="42" yMax="73">
<contour>
<pt x="42" y="73" on="1"/>
<pt x="38" y="34" on="1"/>
</contour>
<instructions/>
</TTGlyph>

<TTGlyph name="e000.0" xMin="38" yMin="69" xMax="41" yMax="72">
<contour>
<pt x="41" y="69" on="1"/>
<pt x="38" y="72" on="1"/>
<pt x="40" y="72" on="1"/>
</contour>
<instructions/>
</TTGlyph>

<TTGlyph name="e000.1" xMin="38" yMin="71" xMax="42" yMax="73">
<contour>
<pt x="42" y="73" on="1"/>
<pt x="38" y="73" on="1"/>
<pt x="39" y="71" on="1"/>
</contour>
<instructions/>
</TTGlyph>

<TTGlyph name="e000.2" xMin="38" yMin="36" xMax="42" yMax="38">
<contour>
<pt x="42" y="38" on="1"/>
<pt x="38" y="38" on="1"/>
<pt x="39" y="36" on="1"/>
</contour>
<instructions/>
</TTGlyph>

<TTGlyph name="e000.3" xMin="38" yMin="34" xMax="41" yMax="38">
<contour>
<pt x="41" y="34" on="1"/>
<pt x="38" y="37" on="1"/>
<pt x="40" y="38" on="1"/>
</contour>
<instructions/>
</TTGlyph>

</glyf>

<COLR>
<Version value="1"/>
<!-- BaseGlyphRecordCount=0 -->
<!-- LayerRecordCount=0 -->
<BaseGlyphV1List>
<!-- BaseGlyphCount=1 -->
<BaseGlyphV1Record index="0">
<BaseGlyph value="e000"/>
<Paint Format="1"><!-- PaintColrLayers -->
<NumLayers value="4"/>
<FirstLayerIndex value="0"/>
</Paint>
</BaseGlyphV1Record>
</BaseGlyphV1List>
<LayerV1List>
<!-- LayerCount=4 -->
<Paint index="0" Format="10"><!-- PaintGlyph -->
<Paint Format="2"><!-- PaintSolid -->
<Color>
<PaletteIndex value="0"/>
<Alpha value="1.0"/>
</Color>
</Paint>
<Glyph value="e000.0"/>
</Paint>
<Paint index="1" Format="10"><!-- PaintGlyph -->
<Paint Format="2"><!-- PaintSolid -->
<Color>
<PaletteIndex value="0"/>
<Alpha value="1.0"/>
</Color>
</Paint>
<Glyph value="e000.1"/>
</Paint>
<Paint index="2" Format="10"><!-- PaintGlyph -->
<Paint Format="2"><!-- PaintSolid -->
<Color>
<PaletteIndex value="0"/>
<Alpha value="1.0"/>
</Color>
</Paint>
<Glyph value="e000.2"/>
</Paint>
<Paint index="3" Format="10"><!-- PaintGlyph -->
<Paint Format="2"><!-- PaintSolid -->
<Color>
<PaletteIndex value="0"/>
<Alpha value="1.0"/>
</Color>
</Paint>
<Glyph value="e000.3"/>
</Paint>
</LayerV1List>
</COLR>

<CPAL>
<version value="0"/>
<numPaletteEntries value="1"/>
<palette index="0">
<color index="0" value="#FFCC00FF"/>
</palette>
</CPAL>

</ttFont>
9 changes: 9 additions & 0 deletions tests/write_font_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,15 @@ def test_vertical_metrics(ascender, descender, linegap):
"involutory_matrix_picosvg.ttx",
{"color_format": "picosvg"},
),
# Check that we do _not_ make composite glyphs with reused paths if
# the latter overlap and the transform for the shape reuse is such
# that the winding direction is reversed
# https://github.com/googlefonts/nanoemoji/issues/287
(
("transformed_components_overlap.svg",),
"transformed_components_overlap.ttx",
{"color_format": "glyf_colr_1"},
),
],
)
def test_write_font_binary(svgs, expected_ttx, config_overrides):
Expand Down

0 comments on commit f6ca23b

Please sign in to comment.