Bug 89080 - cairo truncates font glyphs whose max_x_advance is < bbox width
Summary: cairo truncates font glyphs whose max_x_advance is < bbox width
Status: RESOLVED MOVED
Alias: None
Product: cairo
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Chris Wilson
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-11 08:59 UTC by Massimo
Modified: 2018-08-25 13:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
testcase (1.02 KB, text/plain)
2015-02-11 08:59 UTC, Massimo
Details

Description Massimo 2015-02-11 08:59:00 UTC
Created attachment 113342 [details]
testcase

In _cairo_composite_rectangles_init_for_glyphs extents->bounded
is intersected with the output of 
_cairo_scaled_font_glyph_approximate_extents

http://cgit.freedesktop.org/cairo/tree/src/cairo-composite-rectangles.c#n439

which probably is considered a cheap approximation in excess of
the ink extents. Unfortunately there are fonts for which the
approximation is in defect.

This means that the cheap intersection test can incorrectly fail
and even when there is intersection the output is incorrectly
clipped.

A workaround for the incorrect clip is to swap the arguments
in the call to _cairo_rectangle_intersect so that when there 
is intersection extents->bounded is left unmodified and 
extents->mask is anyway recomputed correctly in the following 
call to _cairo_scaled_font_glyph_device_extents.


This workaround introduces another failure in the test-suite, but
considering test/reference/user-font-mask.ref.png you can see that
the first rows of the ink extent (green) rectangle are white, not
inked at all and the dot of the i is not symmetric, with the
workaround above the dot is symmetric and the ink extents is
corresponding to the 'inked' area.

The attached test case uses the font Mademoiselle Camille
obtained from:

http://www.dafont.com/theme.php?cat=601
Comment 1 Behdad Esfahbod 2015-05-01 19:37:59 UTC
I agree.  I wasn't aware of this approximation code.  Will take a look.
Comment 2 Behdad Esfahbod 2016-03-11 09:15:34 UTC
I don't have time to work on this.  Do any of the current developer have time to take a look?  Thanks in advance!
Comment 3 GitLab Migration User 2018-08-25 13:41:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/139.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.