bugThe FreeType Project - Bugs: bug #39905, FT_Outline_Decompose() outputs...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #39905: FT_Outline_Decompose() outputs stray move_to-line_to pair

Submitter:  John Tytgat <joty>
Submitted:  Fri 30 Aug 2013 06:59:05 PM UTC
   
 
Severity:  3 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.5.1

Mon 02 Sep 2013 08:09:30 PM UTC, comment #3: 

I've added this to the documentation, thanks.

Werner LEMBERG <wl>
Group administrator
Mon 02 Sep 2013 11:23:27 AM UTC, comment #2: 

I now see indeed the 2nd contour.

After reading your pov I don't have a strong feeling this should be fixed in FT and indeed this could be mentioned in the documentation that empty subpaths (or line moveto-lineto segments to the same point) are possible.  For the FT user, this could be worthwhile to filter out before using the outline for stroking purposes (as this results in visible dots when round caps are being used).

John Tytgat <joty>
Fri 30 Aug 2013 10:20:16 PM UTC, comment #1: 

The output is correct: The last two calls handle the second contour in the glyph which contains a single point, probably used to position accents and the like.

It's not clear to me how `FT_Outline_Decompose' should behave.  I agree that the current behaviour is unexpected, so maybe contours with a single point should be ignored.

On the other hand, think of a plotter which draws the glyph outlines with a thick pen.  The final moveto and lineto would draw a point, which is exactly what you would like to see if analyzing the glyph.  If you don't like the behaviour it's rather easy for the user to suppress a zero-length line, but if the single-point contour gets suppressed by `FT_Outline_Decompose', there is no possibility to access it at all.

In summary, I would classify your bug report as a documentation issue, but maybe you can convince me to actually change the code.

Werner LEMBERG <wl>
Group administrator
Fri 30 Aug 2013 06:59:05 PM UTC, original submission:  

Calling FT_Outline_Decompose() for attached font and its glyph 88 ('u') results in following callback sequence:

MoveTo: 19968, 68544
LineTo: 19968, 23040
Conic
Conic
Conic
Conic
LineTo: 51008, 68544
LineTo: 62528, 68544
LineTo: 62528, 0
LineTo: 51648, 0
LineTo: 51776, 10112
Conic
Conic
Conic
Conic
LineTo: 8192, 68544
LineTo: 19968, 68544
MoveTo: 35392, 70208
LineTo: 35392, 70208

The last two calls are a bit surprising, i.e. moveto/lineto to a same point.  I can't immediately see something wrong in the TT data for glyph 88 (nor find a justification for those calls) and believe this is rather due to something unfortunate in the FT_Outline_Decompose() implementation.  I.e. a moveto callback always gets emitted before the 'point < limit' test is being done (and a lineto is closing the path).  I don't see the point to allow this.

Hence, a suggestion to fix this behavior with attached patched (I deliberately didn't indent the new if-body to make it more clean what the change is).  I.e. surpress the output of moveto (and corresponding closing lineto) if there is no subpath to emit.

John Tytgat <joty>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #28962:  Helvetica.ttf added by joty (621KiB - application/octet-stream)
file #28963:  stray_moveto_lineto.patch added by joty (691B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by joty (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-09-02 wl StatusNeed Info Fixed
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.5.1
    2013-08-30 wl StatusNone Need Info
        Assigned toNone wl
    2013-08-30 joty Attached File- Added Helvetica.ttf, #28962
        Attached File- Added stray_moveto_lineto.patch, #28963

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code