mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-26 01:11:25 +01:00
Revert "[COLRv1] Move paint boundedness check to font layer"
This reverts commit c9a26fbf47.
This commit is contained in:
1 parent
c9a26fbf47
commit
78822b6336
3 files changed
+37
-16
No files matched your search
@@ -2695,6 +2695,7 @@ struct COLR
|
||||
{
|
||||
// COLRv1 glyph
|
||||
|
||||
bool is_bounded = true;
|
||||
if (clip)
|
||||
{
|
||||
hb_glyph_extents_t extents;
|
||||
@@ -2709,12 +2710,30 @@ struct COLR
|
||||
extents.y_bearing);
|
||||
}
|
||||
else
|
||||
{
|
||||
clip = false;
|
||||
is_bounded = false;
|
||||
}
|
||||
|
||||
if (!is_bounded)
|
||||
{
|
||||
auto *bounded_funcs = hb_paint_bounded_get_funcs ();
|
||||
scratch.paint_bounded.clear ();
|
||||
|
||||
paint_glyph (font, glyph,
|
||||
bounded_funcs, &scratch.paint_bounded,
|
||||
palette_index, foreground,
|
||||
false,
|
||||
scratch);
|
||||
|
||||
is_bounded = scratch.paint_bounded.is_bounded ();
|
||||
}
|
||||
}
|
||||
|
||||
c.funcs->push_font_transform (c.data, font);
|
||||
|
||||
c.recurse (*paint);
|
||||
if (is_bounded)
|
||||
c.recurse (*paint);
|
||||
|
||||
c.funcs->pop_transform (c.data);
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "hb-atomic.hh"
|
||||
#include "hb-shaper.hh"
|
||||
#include "hb-outline.hh"
|
||||
#include "hb-paint-bounded.hh"
|
||||
|
||||
|
||||
/*
|
||||
@@ -525,19 +524,6 @@ struct hb_font_t
|
||||
unsigned int palette,
|
||||
hb_color_t foreground)
|
||||
{
|
||||
/* COLRv1 spec says a glyph must not be painted if the paint graph
|
||||
* draws unbounded. Implement this here such that all font-funcs
|
||||
* benefit, since we have the code. */
|
||||
auto *bounded_funcs = hb_paint_bounded_get_funcs ();
|
||||
hb_paint_bounded_context_t bounded_data;
|
||||
klass->get.f.paint_glyph (this, user_data,
|
||||
glyph,
|
||||
bounded_funcs, &bounded_data,
|
||||
palette, foreground,
|
||||
!klass->user_data ? nullptr : klass->user_data->paint_glyph);
|
||||
if (!bounded_data.is_bounded ())
|
||||
return;
|
||||
|
||||
klass->get.f.paint_glyph (this, user_data,
|
||||
glyph,
|
||||
paint_funcs, paint_data,
|
||||
|
||||
+17
-1
@@ -28,6 +28,7 @@
|
||||
#include "hb.hh"
|
||||
|
||||
#include "hb-decycler.hh"
|
||||
#include "hb-paint-bounded.hh"
|
||||
|
||||
#include FT_COLOR_H
|
||||
|
||||
@@ -512,6 +513,7 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
|
||||
node.visit (gid);
|
||||
|
||||
bool clip = false;
|
||||
bool is_bounded = false;
|
||||
FT_ClipBox clip_box;
|
||||
if (FT_Get_Color_Glyph_ClipBox (ft_face, gid, &clip_box))
|
||||
{
|
||||
@@ -525,11 +527,25 @@ hb_ft_paint_glyph_colr (hb_font_t *font,
|
||||
font->slant_xy * clip_box.top_right.y)),
|
||||
clip_box.top_right.y);
|
||||
clip = true;
|
||||
is_bounded = true;
|
||||
}
|
||||
if (!is_bounded)
|
||||
{
|
||||
auto *bounded_funcs = hb_paint_bounded_get_funcs ();
|
||||
hb_paint_bounded_context_t bounded_data;
|
||||
hb_ft_paint_context_t ce (ft_font, font,
|
||||
bounded_funcs, &bounded_data,
|
||||
palette_array, palette_index, foreground);
|
||||
hb_decycler_node_t node2 (ce.glyphs_decycler);
|
||||
node2.visit (gid);
|
||||
ce.recurse (paint);
|
||||
is_bounded = bounded_data.is_bounded ();
|
||||
}
|
||||
|
||||
c.funcs->push_font_transform (c.data, font);
|
||||
|
||||
c.recurse (paint);
|
||||
if (is_bounded)
|
||||
c.recurse (paint);
|
||||
|
||||
c.funcs->pop_transform (c.data);
|
||||
|
||||
|
||||
Reference in new issue
Block a user