diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-07-30 19:28:26 -0400 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2021-08-28 09:19:09 +0930 |
commit | 4c7a8afb3bf06743ae9502e68e7b964201606536 (patch) | |
tree | 1cdde65b46ba153e91b45e3512520ce844d652f3 /src/cairo-composite-rectangles.c | |
parent | 5e76dd7a5c0585515eeef5099f12b273c94d3b0f (diff) | |
download | cairo-4c7a8afb3bf06743ae9502e68e7b964201606536.tar.gz |
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.
Diffstat (limited to 'src/cairo-composite-rectangles.c')
-rw-r--r-- | src/cairo-composite-rectangles.c | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/src/cairo-composite-rectangles.c b/src/cairo-composite-rectangles.c index 10f30da92..80e23f23a 100644 --- a/src/cairo-composite-rectangles.c +++ b/src/cairo-composite-rectangles.c @@ -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, |