bugThe FreeType Project - Bugs: bug #27742, Certain combinations of stroke...

 
 

bug #27742: Certain combinations of stroke points / radius break the stroker.

Submitted by:  None
Submitted on:  Sun 18 Oct 2009 04:35:14 AM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.3.12

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 20 Nov 2009 08:36:33 AM UTC, comment #5:

I've applied the patch now. Please reopen the bug in case more
action is needed.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 09 Nov 2009 10:52:53 PM UTC, comment #4:

What about this patch which just tries to avoid the division by zero... Can you test whether it gives satisfying results?

diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c
index 0978b0e..5005b1c 100644
--- a/src/base/ftstroke.c
+++ b/src/base/ftstroke.c
@@ -979,7 +979,8 @@
thcos = FT_Cos( theta );
sigma = FT_MulFix( stroker->miter_limit, thcos );

- if ( sigma >= 0x10000L )
+ /* FT_Sin(x) = 0 for x <= 57 */
+ if ( sigma >= 0x10000L || ft_pos_abs( theta ) <= 57 )
miter = FALSE;

if ( miter ) /* this is a miter (broken angle) */

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 19 Oct 2009 06:49:16 PM UTC, comment #3:

Thanks. Will investigate.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Mon 19 Oct 2009 06:28:39 PM UTC, comment #2:

Hi Werner,

I uploaded a source file that reproduces this issue.

Thanks again,
Jon

Jon Anderson <jbengt>
Sun 18 Oct 2009 08:23:02 AM UTC, comment #1:

Please post an example which triggers the bad behaviour. In case it is a non-free font please email it to me privately.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Sun 18 Oct 2009 04:35:14 AM UTC, original submission:

Hi, I love your package, it does a beautiful job rendering. I tried using the stroker api and it also works well except in certain situations.

If you take a look at the attached png, occaisional mitered joints get a bit out of whack. This seems to be due to strokes that are almost coincident.

I traced this particular problem to ftstroke.c:line 999? There is the statement:
FT_DivFix(0x10000L - sigma, ft_pos_abs(FT_Sin(theta)));

In this situation, the turn tests pass but the angle 'theta' is zero, causing a divide by zero.

I am using freetype-2.3.11.

Thanks, Jon

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #18900:  TestStroke.cpp added by None (836B - text/plain - Here is a simple source file that reveals the problem. I am not parsing a font, I am using the stroker for rendering lines.)
file #18895:  freetypestroke.png added by None (36KiB - image/x-png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jbengt (Posted a comment)
  • -unavailable- added by wl (Posted a comment)
  •  

    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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 20 Nov 2009 08:36:33 AM UTCwlStatusNeed Info=>Fixed
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.3.12
    Mon 09 Nov 2009 10:52:53 PM UTCwlStatusConfirmed=>Need Info
    Sun 01 Nov 2009 10:22:47 AM UTCwlStatusNeed Info=>Confirmed
    Mon 19 Oct 2009 03:30:08 AM UTCNoneAttached File-=>Added TestStroke.cpp, #18900
    Sun 18 Oct 2009 08:23:02 AM UTCwlStatusNone=>Need Info
      Assigned toNone=>wl
    Sun 18 Oct 2009 04:35:14 AM UTCNoneAttached File-=>Added freetypestroke.png, #18895

    Back to the top


    Powered by Savane 3.1-cleanup1