bugThe FreeType Project - Bugs: bug #24430, CID 0 should map to the notdef...

 
 

bug #24430: CID 0 should map to the notdef glyph for CID CFF fonts

Submitted by:  bram tassyns <bramt>
Submitted on:  Thu 02 Oct 2008 09:02:34 AM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.3.8

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Thu 02 Oct 2008 10:21:06 AM UTC, comment #1:

Patch applied, thanks.

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Thu 02 Oct 2008 09:02:34 AM UTC, original submission:

I needed to access the notdef glyph of a CFF CID font but the load glyph call returned an error for GID (CID) 0.

It's defined by the CMap spec that CID 0 should always refer to the notdef glyph. However for CFF CID fonts CID 0 gives an error when attempting to load the glyph. I fixed this so CID 0 will always return GID 0.

I don't know how postscript CID fonts handle this case (we don't support those types), but perhaps it's worth checking how they handle CID 0.

Fix:
cffgload.c

/* in a CID-keyed font, consider `glyph_index' as a CID and map */
/* it immediately to the real glyph_index -- if it isn't a */
/* subsetted font, glyph_indices and CIDs are identical, though */
if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
cff->charset.cids )
{
glyph_index = cff_charset_cid_to_gindex( &cff->charset, glyph_index );
if ( glyph_index == 0 )
return CFF_Err_Invalid_Argument;
}
else if ( glyph_index >= cff->num_glyphs )
return CFF_Err_Invalid_Argument;

==>

/* in a CID-keyed font, consider `glyph_index' as a CID and map */
/* it immediately to the real glyph_index -- if it isn't a */
/* subsetted font, glyph_indices and CIDs are identical, though */
if ( cff->top_font.font_dict.cid_registry != 0xFFFFU &&
cff->charset.cids )
{
// always map the notdef (cid 0) to gid 0
if ( glyph_index )
{
glyph_index = cff_charset_cid_to_gindex( &cff->charset, glyph_index );
if ( glyph_index == 0 )
return CFF_Err_Invalid_Argument;
}
}
else if ( glyph_index >= cff->num_glyphs )
return CFF_Err_Invalid_Argument;

bram tassyns <bramt>

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

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 (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 02 Oct 2008 10:21:06 AM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.3.8

    Back to the top


    Powered by Savane 3.1-cleanup1