bugThe FreeType Project - Bugs: bug #43271, Broken CFF fonts

 
 

bug #43271: Broken CFF fonts

Submitted by:  Denis Simuntis <outqb>
Submitted on:  Sun 21 Sep 2014 02:42:52 PM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Dave Arnold <darnold>Open/Closed: Closed
Planned Release: 2.5.4

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Thu 02 Oct 2014 10:17:41 PM UTC, comment #7:

Just to follow up, the fix was to change the overflow detection to use approximate logarithms (FT_MSB) and to clamp scaledStem.

Dave Arnold <darnold>
Project MemberIn charge of this item.
Thu 02 Oct 2014 04:35:53 AM UTC, comment #6:

This is fixed in the git repository. Please test! And thanks for the report.

Werner LEMBERG <wl>
Project Administrator
Thu 25 Sep 2014 11:24:08 PM UTC, comment #5:

Good catch.

In the original Adobe code, FixMul always detects overflow and clamps. When we moved to FreeType, we wanted to use the existing FT_MulFix, which is non-clamping. Werner and I discussed this exact line at the time because it was identified as one place where the clamping behavior was required. We had a simple plan to handle this, but something seems to have gone wrong. I need to research it a bit more.

Dave Arnold <darnold>
Project MemberIn charge of this item.
Wed 24 Sep 2014 06:58:40 PM UTC, comment #4:

FT_DivFix is actually protected against the overflowing result: see ftcalc.c:301 in ft_div64by32. I am still not sure if this is the right approach though. It is not nice to be overflowing like this at very reasonable sizes. I think that the 1/1000th of a pixel as a huge overkill for the resolution in comparison to more common 1/64th in FreeType.

Alexei Podtelezhnikov <podtelez>
Project Member
Mon 22 Sep 2014 08:52:13 PM UTC, comment #3:

Alexei, I haven't looked at why the results are wider than 32 bits (that might be another issue) but the fact is that overflow really occurs and it's not checked for properly. Once this is done correctly, font distortion goes away.

Denis Simuntis <outqb>
Mon 22 Sep 2014 08:33:06 PM UTC, comment #2:

Dave, please have a look!

Werner LEMBERG <wl>
Project Administrator
Mon 22 Sep 2014 05:07:20 PM UTC, comment #1:

FT_MulFix does or emulates 64-bit calculations with 32-bit arguments and the result should 32-bits as well. Are you saying that the results are wider than 32-bits?

Who needs stem darkening at this huge sizes? (hint, hint at the proper patch)

Alexei Podtelezhnikov <podtelez>
Project Member
Sun 21 Sep 2014 02:42:52 PM UTC, original submission:

Some CFF fonts get broken at particular sizes. The culprit function is cf2_computeDarkening(). It seems that scaledStem and stemWidthPer1000 are incorrectly checked for overflow. Examples of fonts that this problem can be reproduced with are "Adobe Garamond Pro Regular 601pt" and "Birch Std Regular 601pt". See attached screenshots showing the problem and the patch to fix it.

Denis Simuntis <outqb>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #32156:  cf2font.c.patch added by outqb (2KiB - application/octet-stream)
file #32157:  Birch Std Regular 601.png added by outqb (28KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by darnold (Posted a comment)
  • -unavailable- added by wl (Posted a comment)
  • -unavailable- added by podtelez (Posted a comment)
  • -unavailable- added by outqb (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
    Thu 02 Oct 2014 04:35:53 AM UTCwlStatusNone=>Fixed
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.5.4
    Mon 22 Sep 2014 08:33:06 PM UTCwlAssigned toNone=>darnold
    Sun 21 Sep 2014 02:42:52 PM UTCoutqbAttached File-=>Added Adobe Garamond Pro Regular 601.png, #32155
      Attached File-=>Added cf2font.c.patch, #32156
      Attached File-=>Added Birch Std Regular 601.png, #32157

    Back to the top


    Powered by Savane 3.1-cleanup1