Remove the approximate glyph bounds check

We are trying to get an approximate bounding box for
the extents of a glyph string and use it for bailing
early if there's nothing to do, but the code computing
that approximation makes invalid assumptions: It assumes
that a glyph never extends further than max-advance-width
before or after its position. That is not true in general,
as can be seen in https://gitlab.gnome.org/GNOME/gtk/-/issues/4132
In the example there, we have a monospace fonts with ligatures
that have a negative lsb of two or three times the glyph width.

The optimization here could theoretically be fixed by iterating
over the font once to determine suitable values for how far
glyphs can extend before or after their position, but this
patch just removes it.
This commit is contained in:
Matthias Clasen 2021-07-30 19:28:26 -04:00 committed by Adrian Johnson
parent 5e76dd7a5c
commit 4c7a8afb3b

View file

@ -473,20 +473,6 @@ _cairo_composite_rectangles_init_for_glyphs (cairo_composite_rectangles_t *exten
return CAIRO_INT_STATUS_NOTHING_TO_DO;
}
/* Computing the exact bbox and the overlap is expensive.
* First perform a cheap test to see if the glyphs are all clipped out.
*/
if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK &&
_cairo_scaled_font_glyph_approximate_extents (scaled_font,
glyphs, num_glyphs,
&extents->mask))
{
if (! _cairo_rectangle_intersect (&extents->bounded, &extents->mask)) {
_cairo_composite_rectangles_fini(extents);
return CAIRO_INT_STATUS_NOTHING_TO_DO;
}
}
status = _cairo_scaled_font_glyph_device_extents (scaled_font,
glyphs, num_glyphs,
&extents->mask,