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

 
 

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

Submitted by:  John Tytgat <joty>
Submitted on:  Fri 30 Aug 2013 06:59:05 PM UTC  
 
Severity: 3 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.5.1

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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

I've added this to the documentation, thanks.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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.)

Attach File(s):
   
   
Comment:
   

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
  • -unavailable- added by wl (Posted a comment)
  • -unavailable- added by joty (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 02 Sep 2013 08:09:30 PM UTCwlStatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.5.1
    Fri 30 Aug 2013 10:20:16 PM UTCwlStatusNone=>Need Info
      Assigned toNone=>wl
    Fri 30 Aug 2013 06:59:05 PM UTCjotyAttached File-=>Added Helvetica.ttf, #28962
      Attached File-=>Added stray_moveto_lineto.patch, #28963

    Back to the top


    Powered by Savane 3.1-cleanup1