Skip to content

Commit

Permalink
simpler test of reusing shape in different color
Browse files Browse the repository at this point in the history
  • Loading branch information
rsheeter committed Jun 6, 2020
1 parent 7d2e465 commit 29c3eaf
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 15 deletions.
26 changes: 14 additions & 12 deletions tests/clocks.ttx
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,14 @@
<ColorStop index="0">
<StopOffset value="0.3212"/>
<Color>
<PaletteIndex value="5"/>
<PaletteIndex value="6"/>
<Transparency value="0.0"/>
</Color>
</ColorStop>
<ColorStop index="1">
<StopOffset value="1.0"/>
<Color>
<PaletteIndex value="4"/>
<PaletteIndex value="5"/>
<Transparency value="0.0"/>
</Color>
</ColorStop>
Expand Down Expand Up @@ -357,7 +357,7 @@
<LayerGlyph value="e000.4"/>
<Paint Format="1">
<Color>
<PaletteIndex value="6"/>
<PaletteIndex value="8"/>
<Transparency value="0.0"/>
</Color>
</Paint>
Expand Down Expand Up @@ -395,14 +395,14 @@
<ColorStop index="0">
<StopOffset value="0.3212"/>
<Color>
<PaletteIndex value="5"/>
<PaletteIndex value="6"/>
<Transparency value="0.0"/>
</Color>
</ColorStop>
<ColorStop index="1">
<StopOffset value="1.0"/>
<Color>
<PaletteIndex value="4"/>
<PaletteIndex value="5"/>
<Transparency value="0.0"/>
</Color>
</ColorStop>
Expand All @@ -425,7 +425,7 @@
<LayerGlyph value="e000.1"/>
<Paint Format="1">
<Color>
<PaletteIndex value="0"/>
<PaletteIndex value="4"/>
<Transparency value="0.0"/>
</Color>
</Paint>
Expand All @@ -434,7 +434,7 @@
<LayerGlyph value="e001.0"/>
<Paint Format="1">
<Color>
<PaletteIndex value="1"/>
<PaletteIndex value="7"/>
<Transparency value="0.0"/>
</Color>
</Paint>
Expand All @@ -452,7 +452,7 @@
<LayerGlyph value="e000.4"/>
<Paint Format="1">
<Color>
<PaletteIndex value="6"/>
<PaletteIndex value="8"/>
<Transparency value="0.0"/>
</Color>
</Paint>
Expand Down Expand Up @@ -482,15 +482,17 @@

<CPAL>
<version value="0"/>
<numPaletteEntries value="7"/>
<numPaletteEntries value="9"/>
<palette index="0">
<color index="0" value="#0000FFFF"/>
<color index="1" value="#008000FF"/>
<color index="2" value="#424242FF"/>
<color index="3" value="#757575FF"/>
<color index="4" value="#B0BEC5FF"/>
<color index="5" value="#ECEFF1FF"/>
<color index="6" value="#FFFFFFFF"/>
<color index="4" value="#800080FF"/>
<color index="5" value="#B0BEC5FF"/>
<color index="6" value="#ECEFF1FF"/>
<color index="7" value="#FF0000FF"/>
<color index="8" value="#FFFFFFFF"/>
</palette>
</CPAL>

Expand Down
4 changes: 3 additions & 1 deletion tests/make_emoji_font_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def test_codepoints_from_filename(filename, codepoints):
(("linear_gradient_rect.svg",), "linear_gradient_rect.ttx", "colr_1", ".ttf"),
# radial gradient on rect
(("radial_gradient_rect.svg",), "radial_gradient_rect.ttx", "colr_1", ".ttf"),
# clocks have so very many reusable parts
# reuse shape in different color
(("rect.svg", "rect2.svg"), "rects.ttx", "colr_1", ".ttf"),
# clocks have composites, reuse of composite, and reuse of shape w/diff color
(("one-o-clock.svg", "two-o-clock.svg"), "clocks.ttx", "colr_1", ".ttf"),
# TODO reusable clock parts for glyf, svg, svgz
],
Expand Down
5 changes: 5 additions & 0 deletions tests/rect2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
155 changes: 155 additions & 0 deletions tests/rects.ttx
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?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="e001"/>
<GlyphID id="4" name="e000.0"/>
<GlyphID id="5" name="e000.1"/>
</GlyphOrder>

<hmtx>
<mtx name=".notdef" width="0" lsb="0"/>
<mtx name=".space" width="100" lsb="0"/>
<mtx name="e000" width="100" lsb="0"/>
<mtx name="e000.0" width="100" lsb="20"/>
<mtx name="e000.1" width="100" lsb="40"/>
<mtx name="e001" 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"/><!-- ???? -->
<map code="0xe001" name="e001"/><!-- ???? -->
</cmap_format_4>
<cmap_format_4 platformID="3" platEncID="1" language="0">
<map code="0x20" name=".space"/><!-- SPACE -->
<map code="0xe000" name="e000"/><!-- ???? -->
<map code="0xe001" name="e001"/><!-- ???? -->
</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="0" yMin="0" xMax="100" yMax="100">
<contour>
<pt x="100" y="100" on="1"/>
<pt x="0" y="0" on="1"/>
</contour>
<instructions/>
</TTGlyph>

<TTGlyph name="e000.0" xMin="20" yMin="60" xMax="80" yMax="80">
<contour>
<pt x="20" y="80" on="1"/>
<pt x="20" y="60" on="1"/>
<pt x="80" y="60" on="1"/>
<pt x="80" y="80" on="1"/>
</contour>
<instructions/>
</TTGlyph>

<TTGlyph name="e000.1" xMin="40" yMin="40" xMax="100" yMax="60">
<contour>
<pt x="40" y="60" on="1"/>
<pt x="40" y="40" on="1"/>
<pt x="100" y="40" on="1"/>
<pt x="100" y="60" on="1"/>
</contour>
<instructions/>
</TTGlyph>

<TTGlyph name="e001" xMin="0" yMin="0" xMax="100" yMax="100">
<contour>
<pt x="100" y="100" on="1"/>
<pt x="0" y="0" on="1"/>
</contour>
<instructions/>
</TTGlyph>

</glyf>

<COLR>
<Version value="1"/>
<!-- BaseGlyphRecordCount=0 -->
<!-- LayerRecordCount=0 -->
<BaseGlyphV1Array>
<!-- BaseGlyphCount=2 -->
<BaseGlyphV1Record index="0">
<BaseGlyph value="e000"/>
<LayerV1Array>
<!-- LayerCount=2 -->
<LayerV1Record index="0">
<LayerGlyph value="e000.0"/>
<Paint Format="1">
<Color>
<PaletteIndex value="0"/>
<Transparency value="0.0"/>
</Color>
</Paint>
</LayerV1Record>
<LayerV1Record index="1">
<LayerGlyph value="e000.1"/>
<Paint Format="1">
<Color>
<PaletteIndex value="0"/>
<Transparency value="0.2"/>
</Color>
</Paint>
</LayerV1Record>
</LayerV1Array>
</BaseGlyphV1Record>
<BaseGlyphV1Record index="1">
<BaseGlyph value="e001"/>
<LayerV1Array>
<!-- LayerCount=2 -->
<LayerV1Record index="0">
<LayerGlyph value="e000.0"/>
<Paint Format="1">
<Color>
<PaletteIndex value="2"/>
<Transparency value="0.0"/>
</Color>
</Paint>
</LayerV1Record>
<LayerV1Record index="1">
<LayerGlyph value="e000.1"/>
<Paint Format="1">
<Color>
<PaletteIndex value="1"/>
<Transparency value="0.2"/>
</Color>
</Paint>
</LayerV1Record>
</LayerV1Array>
</BaseGlyphV1Record>
</BaseGlyphV1Array>
</COLR>

<CPAL>
<version value="0"/>
<numPaletteEntries value="3"/>
<palette index="0">
<color index="0" value="#0000FFFF"/>
<color index="1" value="#006400FF"/>
<color index="2" value="#800080FF"/>
</palette>
</CPAL>

</ttFont>
4 changes: 2 additions & 2 deletions tests/two-o-clock.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 29c3eaf

Please sign in to comment.