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

 
 

You are not allowed to post comments on this tracker with your current authentication level.

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

Submitter:  bram tassyns <bramt>
Submitted:  Thu 02 Oct 2008 09:02:34 AM UTC
   
 
Severity:  3 - Normal Item Group:  Incorrect behaviour
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.3.8

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

Patch applied, thanks.

Werner LEMBERG <wl>
Group administrator
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.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by bramt (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-10-02 wl StatusNone Fixed
        Assigned toNone wl
        Open/ClosedOpen Closed
        Planned ReleaseNone 2.3.8

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code