[paint] Add COLRv0 tests

This commit is contained in:
Matthias Clasen 2022-12-22 16:06:51 -05:00 committed by Behdad Esfahbod
parent 6909701b36
commit 47dbebff39
5 changed files with 59 additions and 12 deletions

Binary file not shown.

View File

@ -0,0 +1,12 @@
start clip glyph 12
solid 81 61 50 255
end clip
start clip glyph 13
solid 245 185 68 255
end clip
start clip glyph 14
solid 224 142 55 255
end clip
start clip glyph 15
solid 245 202 86 255
end clip

View File

@ -0,0 +1,12 @@
start clip glyph 16
solid 81 61 50 255
end clip
start clip glyph 17
solid 245 185 68 255
end clip
start clip glyph 18
solid 224 142 55 255
end clip
start clip glyph 19
solid 245 202 86 255
end clip

View File

@ -0,0 +1,12 @@
start clip glyph 8
solid 81 61 50 255
end clip
start clip glyph 9
solid 245 185 68 255
end clip
start clip glyph 10
solid 224 142 55 255
end clip
start clip glyph 11
solid 245 202 86 255
end clip

View File

@ -559,7 +559,10 @@ static void
paint_image (hb_paint_funcs_t *funcs,
void *paint_data,
hb_blob_t *blob,
unsigned int width,
unsigned int height,
hb_tag_t format,
float slant,
hb_glyph_extents_t *extents,
void *user_data)
{
@ -567,8 +570,9 @@ paint_image (hb_paint_funcs_t *funcs,
char buf[5] = { 0, };
hb_tag_to_string (format, buf);
print (data, "image type %s extents %d %d %d %d\n",
buf, extents->x_bearing, extents->y_bearing, extents->width, extents->height);
print (data, "image type %s size %u %u slant %f extents %d %d %d %d\n",
buf, width, height, slant,
extents->x_bearing, extents->y_bearing, extents->width, extents->height);
}
static void
@ -680,23 +684,30 @@ typedef struct {
int scale;
float slant;
hb_codepoint_t glyph;
unsigned int palette;
const char *output;
} colrv1_test_t;
#define NOTO_HAND "fonts/noto_handwriting-cff2_colr_1.otf"
#define TEST_GLYPHS "fonts/test_glyphs-glyf_colr_1.ttf"
#define ROCHER_ABC "fonts/RocherColorGX.abc.ttf"
static colrv1_test_t colrv1_tests[] = {
{ NOTO_HAND, 20, 0., 10, "hand-20-0-10" },
{ NOTO_HAND, 20, 0.2, 10, "hand-20-0.2-10" },
{ TEST_GLYPHS, 20, 0, 6, "test-20-0-6" },
{ TEST_GLYPHS, 20, 0, 10, "test-20-0-10" },
{ TEST_GLYPHS, 20, 0, 92, "test-20-0-92" },
{ TEST_GLYPHS, 20, 0, 106, "test-20-0-106" },
{ TEST_GLYPHS, 20, 0, 116, "test-20-0-116" },
{ TEST_GLYPHS, 20, 0, 123, "test-20-0-123" },
{ TEST_GLYPHS, 20, 0, 165, "test-20-0-165" },
{ TEST_GLYPHS, 20, 0, 175, "test-20-0-175" },
/* COLRv1 */
{ NOTO_HAND, 20, 0., 10, 0, "hand-20-0-10" },
{ NOTO_HAND, 20, 0.2, 10, 0, "hand-20-0.2-10" },
{ TEST_GLYPHS, 20, 0, 6, 0, "test-20-0-6" },
{ TEST_GLYPHS, 20, 0, 10, 0, "test-20-0-10" },
{ TEST_GLYPHS, 20, 0, 92, 0, "test-20-0-92" },
{ TEST_GLYPHS, 20, 0, 106, 0, "test-20-0-106" },
{ TEST_GLYPHS, 20, 0, 116, 0, "test-20-0-116" },
{ TEST_GLYPHS, 20, 0, 123, 0, "test-20-0-123" },
{ TEST_GLYPHS, 20, 0, 165, 0, "test-20-0-165" },
{ TEST_GLYPHS, 20, 0, 175, 0, "test-20-0-175" },
/* COLRv0 */
{ ROCHER_ABC, 120, 0.3, 1, 0, "rocher-20-0.3-1" },
{ ROCHER_ABC, 120, 0.3, 2, 2, "rocher-20-0-2" },
{ ROCHER_ABC, 120, 0, 3, 200, "rocher-20-0-3" },
};
static void