gsk: Add a compare test for mixed color runs

This tests the fixes in aa82190da659b5 and dcaa2c4ccb182c74cb40.

The test uses a custom font named 'text-mixed-color' which contains
six glyphs that are just boxes. Glyphs 1, 2, 3 are just plain glyphs,
and glyphs 4, 5, 6 are color glyphs in red, green and blue.

The glyphs are mapped to the characters A, B, C, D, E, F.

The test is currently disabled for cairo, since it has some issues
with transformed color glyphs.
This commit is contained in:
Matthias Clasen
2024-01-10 07:56:52 -05:00
parent a44ca6756a
commit 781fe2d7fa
5 changed files with 197 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
transform {
transform: translate(0, 100);
child: text {
font: "text-mixed-color 20";
glyphs: 1 20, 2 20, 3 20, 4 20 0 0 color, 5 20 0 0 color, 6 20 0 0 color;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

View File

@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="utf-8"?>
<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="2.4">
<GlyphOrder>
<!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
<GlyphID id="0" name=".notdef"/>
<GlyphID id="1" name="A"/>
<GlyphID id="2" name="B"/>
<GlyphID id="3" name="C"/>
<GlyphID id="4" name="D"/>
<GlyphID id="5" name="E"/>
<GlyphID id="6" name="F"/>
</GlyphOrder>
<head>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="1.0"/>
<fontRevision value="1.1"/>
<checkSumAdjustment value="0x2a3f4cae"/>
<magicNumber value="0x5f0f3cf5"/>
<flags value="00000000 00000010"/>
<unitsPerEm value="2048"/>
<created value="Tue Jan 9 00:00:00 2024"/>
<modified value="Tue Jan 9 00:00:00 2024"/>
<xMin value="0"/>
<yMin value="0"/>
<xMax value="0"/>
<yMax value="0"/>
<macStyle value="00000000 00000000"/>
<lowestRecPPEM value="1"/>
<fontDirectionHint value="2"/>
<indexToLocFormat value="0"/>
<glyphDataFormat value="0"/>
</head>
<hhea>
<tableVersion value="1.0"/>
<ascent value="2048"/>
<descent value="0"/>
<lineGap value="0"/>
<advanceWidthMax value="20480"/>
<minLeftSideBearing value="0"/>
<minRightSideBearing value="0"/>
<xMaxExtent value="0"/>
<caretSlopeRise value="1"/>
<caretSlopeRun value="0"/>
<caretOffset value="0"/>
<reserved0 value="0"/>
<reserved1 value="0"/>
<reserved2 value="0"/>
<reserved3 value="0"/>
<metricDataFormat value="0"/>
<numberOfHMetrics value="2"/>
</hhea>
<maxp>
<!-- Most of this table will be recalculated by the compiler -->
<tableVersion value="0x10000"/>
<numGlyphs value="4"/>
<maxPoints value="0"/>
<maxContours value="0"/>
<maxCompositePoints value="0"/>
<maxCompositeContours value="0"/>
<maxZones value="1"/>
<maxTwilightPoints value="0"/>
<maxStorage value="0"/>
<maxFunctionDefs value="0"/>
<maxInstructionDefs value="0"/>
<maxStackElements value="0"/>
<maxSizeOfInstructions value="0"/>
<maxComponentElements value="0"/>
<maxComponentDepth value="0"/>
</maxp>
<hmtx>
<mtx name=".notdef" width="1024" lsb="0"/>
<mtx name="A" width="1024" lsb="0"/>
<mtx name="B" width="1024" lsb="0"/>
<mtx name="C" width="1024" lsb="0"/>
<mtx name="D" width="1024" lsb="0"/>
<mtx name="E" width="1024" lsb="0"/>
<mtx name="F" width="1024" lsb="0"/>
</hmtx>
<loca>
</loca>
<glyf> <!-- Will result in empty table -->
<TTGlyph name=".notdef"/>
<TTGlyph name="A">
<contour>
<pt x="0" y="0" on="1"/>
<pt x="1024" y="0" on="1"/>
<pt x="1024" y="2048" on="1"/>
<pt x="0" y="2048" on="1"/>
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
<TTGlyph name="B">
<contour>
<pt x="0" y="0" on="1"/>
<pt x="1024" y="0" on="1"/>
<pt x="1024" y="2048" on="1"/>
<pt x="0" y="2048" on="1"/>
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
<TTGlyph name="C">
<contour>
<pt x="0" y="0" on="1"/>
<pt x="1024" y="0" on="1"/>
<pt x="1024" y="2048" on="1"/>
<pt x="0" y="2048" on="1"/>
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
<TTGlyph name="D">
<contour>
<pt x="0" y="0" on="1"/>
<pt x="1024" y="0" on="1"/>
<pt x="1024" y="2048" on="1"/>
<pt x="0" y="2048" on="1"/>
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
<TTGlyph name="E">
<contour>
<pt x="0" y="0" on="1"/>
<pt x="1024" y="0" on="1"/>
<pt x="1024" y="2048" on="1"/>
<pt x="0" y="2048" on="1"/>
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
<TTGlyph name="F">
<contour>
<pt x="0" y="0" on="1"/>
<pt x="1024" y="0" on="1"/>
<pt x="1024" y="2048" on="1"/>
<pt x="0" y="2048" on="1"/>
</contour>
<instructions><assembly></assembly></instructions>
</TTGlyph>
</glyf>
<COLR>
<version value="0"/>
<ColorGlyph name="D">
<layer colorID="0" name="B"/>
</ColorGlyph>
<ColorGlyph name="E">
<layer colorID="1" name="C"/>
</ColorGlyph>
<ColorGlyph name="F">
<layer colorID="2" name="C"/>
</ColorGlyph>
</COLR>
<CPAL>
<version value="0"/>
<numPaletteEntries value="3"/>
<palette index="0">
<color index="0" value="#FF0000FF"/>
<color index="1" value="#00FF00FF"/>
<color index="2" value="#0000FFFF"/>
</palette>
</CPAL>
<name>
<namerecord nameID="0" platformID="1" platEncID="0" langID="0x0" unicode="True">
text-mixed-color
</namerecord>
</name>
<cmap>
<tableVersion version="0"/>
<cmap_format_4 platformID="0" platEncID="3" language="0">
<map code="0x20" name=".notdef"/>
<map code="0x41" name="A"/>
<map code="0x42" name="B"/>
<map code="0x43" name="C"/>
<map code="0x44" name="D"/>
<map code="0x45" name="E"/>
<map code="0x46" name="F"/>
</cmap_format_4>
</cmap>
</ttFont>

View File

@@ -129,6 +129,7 @@ compare_render_tests = [
'stroke-clipped-nogl',
'stroke-opacity',
'stroke-with-3d-contents-nogl-nocairo',
'text-mixed-color-nocairo',
'texture-coords',
'texture-scale-filters-nocairo',
'texture-scale-magnify-10000x',