bugThe FreeType Project - Bugs: bug #33816, Scaling factor is wrong in CID CFF...

 
 

bug #33816: Scaling factor is wrong in CID CFF font with no FontMatrix in top dict.

Submitted by:  None
Submitted on:  Fri 22 Jul 2011 12:55:18 PM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.4.7

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 20 Sep 2011 07:52:35 AM UTC, comment #4:

Tested the current git version in our font regression tester.
Seems to work fine.

Thanks

bram tassyns <bramt>
Wed 07 Sep 2011 06:15:31 PM UTC, comment #3:

I've followed your suggestion, and the heuristic part is gone. Please test!

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Thu 18 Aug 2011 04:40:47 AM UTC, comment #2:

I'm working on it, more or less – I want to understand the change :-) I have been distracted by adding some debugging code to FreeType (for better logging of the CFF parsing), then real life interfered.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Tue 16 Aug 2011 09:30:31 AM UTC, comment #1:

Issue has been open for quite a while, is there a reason nothing has been done for it yet? Just let me know if you need more information.

bram tassyns <bramt>
Fri 22 Jul 2011 12:55:18 PM UTC, original submission:

Attached is a font file extracted from a PDF. It contains a CID CFF font with a single sub font. The top dict contains no FontMatrix, the sub font dict does.

If the sub font dict specifies a FontMatrix, and the Top dict does not. The matrix from the sub font dict should be used (and not divided by 1000 by multiplying it with the default value of the FontMatrix for the Top dict).

There is already some fuzzy code present to fix this case (by checking if the scale factor is abnormally high), in cffobjs.c:691

...
if ( temp != 0x10000L )
{
upm = FT_DivFix( upm, temp );

/* if upm is larger than 1001000 we divide by 1000 -- */
/* this can happen if e.g. there is no top-font FontMatrix */
/* and the subfont FontMatrix already contains the complete */
/* scaling for the subfont (see section 5.11 of the PLRM) */

/* 100 is a heuristic value */

if ( upm > 100L 1000L )
upm = ( upm + 500 ) / 1000;

matrix->xx = FT_DivFix( matrix->xx, temp );
matrix->yx = FT_DivFix( matrix->yx, temp );
matrix->xy = FT_DivFix( matrix->xy, temp );
matrix->yy = FT_DivFix( matrix->yy, temp );
offset->x = FT_DivFix( offset->x, temp );
offset->y = FT_DivFix( offset->y, temp );
}
...

My problem is fixed by moving the lines:

if ( upm > 100L 1000L )
upm = ( upm + 500 ) / 1000;

outside of the if (together with the comments). I don't see a reason why this fix should only be applied for the case where FT_ABS( matrix->yy ) != 0x10000L.

This fixes my problem without changing too much in the underlying code. However I do have questions with the existing code. Why not check if the top dicts font matrix was present (or simply filled in by default) and have special code for that case in the if structure above it that combines the top font matrix and sub font matrix?

Anonymous

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #23681:  PRN58666.cff added by None (3KiB - 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 bramt (Posted a comment)
  • -unavailable- added by bramt
  •  

    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
    Wed 07 Sep 2011 06:15:31 PM UTCwlStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.4.7
    Thu 18 Aug 2011 04:41:27 AM UTCwlStatusNone=>In Progress
      Assigned toNone=>wl
    Mon 25 Jul 2011 07:58:35 AM UTCbramtCarbon-Copy-=>Added bramt
    Fri 22 Jul 2011 12:55:18 PM UTCNoneAttached File-=>Added PRN58666.cff, #23681

    Back to the top


    Powered by Savane 3.1-cleanup1