Bug 43686 - Artifact when drawing the letter 'u' from DejaVuSans.ttf
Summary: Artifact when drawing the letter 'u' from DejaVuSans.ttf
Status: RESOLVED MOVED
Alias: None
Product: cairo
Classification: Unclassified
Component: freetype font backend (show other bugs)
Version: 1.10.3
Hardware: Other All
: medium normal
Assignee: David Turner
QA Contact: cairo-bugs mailing list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-10 02:08 UTC by Tristan Van Berkom
Modified: 2018-08-25 13:26 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Screenshot showing artifact on the letter 'u' (5.16 KB, image/png)
2011-12-10 02:08 UTC, Tristan Van Berkom
Details
The DejaVuSans.ttf file in use when rendering the artifact on the letter 'u' (607.70 KB, application/octet-stream)
2011-12-10 02:11 UTC, Tristan Van Berkom
Details

Description Tristan Van Berkom 2011-12-10 02:08:39 UTC
Created attachment 54283 [details]
Screenshot showing artifact on the letter 'u'

This is originally filed as a pangocairo bug here:
   http://bugzilla.gnome.org/show_bug.cgi?id=665384

The attached screenshot show the problem (it happens to be rendered
using pangocairo onto a CoglTexture and displayed with Clutter, that
should of course not be relevant...).

I've made a printout of the resulting path drawing just
the letter 'u', here it is for reference:

Header: move to
 Point 1: x = 7.437500 y = 48.250000
Header: line to
 Point 1: x = 7.437500 y = 27.000000
Header: line to
 Point 1: x = 13.187500 y = 27.000000
Header: line to
 Point 1: x = 13.187500 y = 48.015625
Header: curve to
 Point 1: x = 13.187500 y = 51.339844
 Point 2: x = 13.832031 y = 53.835938
 Point 3: x = 15.125000 y = 55.500000
Header: curve to
 Point 1: x = 16.414062 y = 57.156250
 Point 2: x = 18.351562 y = 57.984375
 Point 3: x = 20.937500 y = 57.984375
Header: curve to
 Point 1: x = 24.039062 y = 57.984375
 Point 2: x = 26.492188 y = 56.996094
 Point 3: x = 28.296875 y = 55.015625
Header: curve to
 Point 1: x = 30.097656 y = 53.027344
 Point 2: x = 31.000000 y = 50.320312
 Point 3: x = 31.000000 y = 46.890625
Header: line to
 Point 1: x = 31.000000 y = 27.000000
Header: line to
 Point 1: x = 36.750000 y = 27.000000
Header: line to
 Point 1: x = 36.750000 y = 62.156250
Header: line to
 Point 1: x = 31.000000 y = 62.156250
Header: line to
 Point 1: x = 31.000000 y = 56.703125
Header: curve to
 Point 1: x = 29.601562 y = 58.828125
 Point 2: x = 27.984375 y = 60.414062
 Point 3: x = 26.140625 y = 61.453125
Header: curve to
 Point 1: x = 24.296875 y = 62.484375
 Point 2: x = 22.156250 y = 63.000000
 Point 3: x = 19.718750 y = 63.000000
Header: curve to
 Point 1: x = 15.695312 y = 63.000000
 Point 2: x = 12.644531 y = 61.750000
 Point 3: x = 10.562500 y = 59.250000
Header: curve to
 Point 1: x = 8.476562 y = 56.742188
 Point 2: x = 7.437500 y = 53.074219
 Point 3: x = 7.437500 y = 48.250000
Header: close path
Header: move to
 Point 1: x = 21.906250 y = 26.156250
Header: close path

And some comments from Behdad which should be useful in
fixing the problem here:
==========================================================
In cairo-ft-font.c:

Around here:

    /* Font glyphs have an inverted Y axis compared to cairo. */ 
    FT_Outline_Transform (&glyph->outline, &invert_y); 
    if (FT_Outline_Decompose (&glyph->outline, &outline_funcs, path)) { 
↦       _cairo_path_fixed_destroy (path); 
↦       return _cairo_error (CAIRO_STATUS_NO_MEMORY); 
    }  

    status = _cairo_path_fixed_close_path (path); 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    if (unlikely (status)) { 
↦       _cairo_path_fixed_destroy (path); 
↦       return status; 
    } 

This logic should be updated instead to check whether the last operation is a
move_to, and in that case simply drop the move_to instead of adding a
close_path().  In fact, same fix is needed in the move_to outline_funcs
callback too.

One should also pursue a fix in FreeType.  And in DejaVu.  And possibly
Fontforge who generated the TTF.
==========================================================

As I can only attach one file at a time, following up next with
an attachment of the actual DejaVuSans.ttf from my system which
is showing the problem.
Comment 1 Tristan Van Berkom 2011-12-10 02:11:32 UTC
Created attachment 54284 [details]
The DejaVuSans.ttf file in use when rendering the artifact on the letter 'u'
Comment 2 Behdad Esfahbod 2011-12-10 13:08:29 UTC
Someone should clone this and assign to FreeType too.
Comment 3 Bill Spitzak 2011-12-13 12:58:44 UTC
Does seem like a bug in freetype. There are other drawing libraries that will draw a dot for this sequence of path commands as well, and therefore freetype should avoid producing extra path sections that it thinks are invisible.
Comment 4 Behdad Esfahbod 2012-08-25 20:59:57 UTC
Ping, anyone?
Comment 5 GitLab Migration User 2018-08-25 13:26: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/6.


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.