This commit is contained in:
Behdad Esfahbod 2023-08-14 16:47:01 -06:00
parent 74527670fc
commit 58effbcc4f
4 changed files with 20 additions and 3 deletions

View file

@ -2437,8 +2437,13 @@ void PaintColrGlyph::paint_glyph (hb_paint_context_t *c) const
{
TRACE_PAINT (this);
c->funcs->push_inverse_root_transform (c->data, c->font);
if (c->funcs->color_glyph (c->data, gid, c->font))
{
c->funcs->pop_transform (c->data);
return;
}
c->funcs->pop_transform (c->data);
const COLR *colr_table = c->get_colr_table ();
const Paint *paint = colr_table->get_base_glyph_paint (gid);

View file

@ -176,11 +176,19 @@ hb_cairo_paint_color_glyph (hb_paint_funcs_t *pfuncs HB_UNUSED,
hb_cairo_context_t *c = (hb_cairo_context_t *) paint_data;
cairo_t *cr = c->cr;
cairo_save (cr);
hb_position_t x_scale, y_scale;
hb_font_get_scale (font, &x_scale, &y_scale);
cairo_scale (cr, x_scale, y_scale);
cairo_glyph_t cairo_glyph = { glyph, 0, 0 };
cairo_set_scaled_font (cr, c->scaled_font);
cairo_set_font_size (cr, hb_face_get_upem (hb_font_get_face (font)));
cairo_set_font_size (cr, 1);
cairo_show_glyphs (cr, &cairo_glyph, 1);
cairo_restore (cr);
return true;
}

View file

@ -1,10 +1,14 @@
# random seed: R02S9ffd1e4fb7cd9c50371f61b259bb32b5
# random seed: R02S33c307340a09918aefe09266feb15798
# Start of hb tests
# Start of paint tests
# Start of ot tests
start clip rectangle 0 500 500 1e+03
start transform 1 0 0 1 0 0
start transform 1 0 -0 1 0 0
end transform
start clip rectangle 100 100 900 900
start transform 1 0 -0 1 0 0
end transform
start clip rectangle 0 0 1e+03 1e+03
start transform 1 0 -0 1 0 0
start clip glyph 2

View file

@ -389,7 +389,7 @@ test_hb_paint (gconstpointer d,
/* Run
*
* GENERATE_DATA=1 G_TEST_SRCDIR=./test/api ./build/test/api/test-ot-color -p TESTCASE > test/api/results/OUTPUT
* GENERATE_DATA=1 G_TEST_SRCDIR=./test/api ./build/test/api/test-paint -p TESTCASE > test/api/results/OUTPUT
*
* to produce the expected results file.
*/