bugThe FreeType Project - Bugs: bug #21794, bad rendering due to incorrect...

 
 

bug #21794: bad rendering due to incorrect parsing of CFF "real" values

Submitted by:  None
Submitted on:  Thu 13 Dec 2007 07:18:04 PM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.3.6

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 14 Dec 2007 07:49:21 AM UTC, comment #1:

Patch applied, thanks.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Thu 13 Dec 2007 07:18:04 PM UTC, original submission:

The CFF parser incorrectly assembles its return value into 16.16 form, which can lead to significant rendering errors depending on the values used in the font.

The attached PDF "aprob.pdf" demonstrates the problem when displayed with a FreeType-based viewer such as Evince. The 4 lines of Arabic text should all have similar glyph sizes, but the glyphs in the 3rd of these lines are rendered much too small.

Analysis: the PDF contains an embedded CFF font, AdobeArabic-Regular, which uses unusual FontMatrix values [0.000488281 0 0 0.000488281 0 0], where the real-valued entries are encoded as 1e 4a 88 28 1c 4f in the CFF stream.

The FreeType function cff_parse_real (in src/cffparse.c) applies "power_ten" division to the integer part of the value too early; this can cause the most significant digit(s) of the final result to be lost as the value is truncated to an integer. Subsequently shifting it into the high 16 bits of the final result does not restore the lost bits.

A proposed patch is attached; this corrects the behavior by converting the value to 16.16 format before applying any necessary power_ten adjustment. With this patch applied to FreeType, the sample PDF displays correctly in Evince (or other viewers that rely on FT for font rendering).

(Aside: it seems that Adobe Reader 8 also has a problem with this PDF, though in a different way. It renders the glyphs too large, as if assumes a standard FontMatrix of [0.001 0 0 0.001 0 0]. Earlier versions (tested both 5.0 and 7.0) displayed the glyphs correctly scaled.)

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #14621:  aprob.pdf added by None (27KiB - application/pdf)
file #14622:  cffparse.c.patch added by None (1KiB - 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 jkew (originally submitted this bug/patch without login)
  •  

    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
    Fri 14 Dec 2007 07:49:21 AM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.3.6
    Fri 14 Dec 2007 04:56:10 AM UTCjkewCarbon-Copy-=>Added -unavailable-
    Thu 13 Dec 2007 07:18:05 PM UTCNoneAttached File-=>Added aprob.pdf, #14621
      Attached File-=>Added cffparse.c.patch, #14622

    Back to the top


    Powered by Savane 3.1-cleanup1