[COLRv1] Port ot and ft to new push_clip_unscaled_glyph

This commit is contained in:
Behdad Esfahbod 2025-03-21 12:54:12 -06:00
parent 3a8785a7a1
commit 10f09145ed
2 changed files with 37 additions and 12 deletions

View file

@ -938,13 +938,25 @@ struct PaintGlyph
void paint_glyph (hb_paint_context_t *c) const
{
TRACE_PAINT (this);
c->funcs->push_inverse_font_transform (c->data, c->font);
c->funcs->push_clip_glyph (c->data, gid, c->font);
c->funcs->push_font_transform (c->data, c->font);
bool ret = c->funcs->push_clip_unscaled_glyph (c->data, gid, c->font);
if (!ret)
{
c->funcs->push_inverse_font_transform (c->data, c->font);
c->funcs->push_clip_glyph (c->data, gid, c->font);
c->funcs->push_font_transform (c->data, c->font);
}
c->recurse (this+paint);
c->funcs->pop_transform (c->data);
c->funcs->pop_clip (c->data);
c->funcs->pop_transform (c->data);
if (ret)
c->funcs->pop_clip (c->data);
else
{
c->funcs->pop_transform (c->data);
c->funcs->pop_clip (c->data);
c->funcs->pop_transform (c->data);
}
}
HBUINT8 format; /* format = 10 */

View file

@ -316,15 +316,28 @@ _hb_ft_paint (hb_ft_paint_context_t *c,
break;
case FT_COLR_PAINTFORMAT_GLYPH:
{
c->funcs->push_inverse_font_transform (c->data, c->font);
c->ft_font->lock.unlock ();
c->funcs->push_clip_glyph (c->data, paint.u.glyph.glyphID, c->font);
bool ret = c->funcs->push_clip_unscaled_glyph (c->data, paint.u.glyph.glyphID, c->font);
c->ft_font->lock.lock ();
c->funcs->push_font_transform (c->data, c->font);
if (!ret)
{
c->funcs->push_inverse_font_transform (c->data, c->font);
c->ft_font->lock.unlock ();
c->funcs->push_clip_glyph (c->data, paint.u.glyph.glyphID, c->font);
c->ft_font->lock.lock ();
c->funcs->push_font_transform (c->data, c->font);
}
c->recurse (paint.u.glyph.paint);
c->funcs->pop_transform (c->data);
c->funcs->pop_clip (c->data);
c->funcs->pop_transform (c->data);
if (ret)
c->funcs->pop_clip (c->data);
else
{
c->funcs->pop_transform (c->data);
c->funcs->pop_clip (c->data);
c->funcs->pop_transform (c->data);
}
}
break;
case FT_COLR_PAINTFORMAT_COLR_GLYPH: