bugThe FreeType Project - Bugs: bug #27294, Type 1 font with only .notdef...

 
 

bug #27294: Type 1 font with only .notdef results in incorrect custom cmap

Submitted by:  John Tytgat <joty>
Submitted on:  Fri 21 Aug 2009 03:29:17 PM UTC  
 
Severity: 3 - NormalItem Group: Incorrect behaviour
Status: FixedPrivacy: Public
Assigned to: Werner LEMBERG <wl>Open/Closed: Closed
Planned Release: 2.3.10

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Tue 01 Sep 2009 06:12:35 AM UTC, comment #1:

I've applied your larger patch to the git. Thanks!

Werner LEMBERG <wl>
Project AdministratorIn charge of this item.
Fri 21 Aug 2009 03:29:17 PM UTC, original submission:

There is a problem in T1_Open_Face() in src/type1/t1load.c when the Type 1 font only contains the .notdef glyph as at the end of that routine type1->encoding.code_first gets assigned 0 (ok) and type1->encoding.code_last gets assigned 256 which is not ok as code_last is the last non-.notdef character found.

This gives a problem in t1_cmap_custom_char_next() iteration as cmap->count is 257 (see t1_cmap_custom_init, it is the calculation of code_last - code_first + 1).

A working (minimal) patch is:

--8<--
if ( min_char > max_char )
{
min_char = 0;
- max_char = loader.encoding_table.max_elems;
+ max_char = 0;
}
--8<--

But this is not ideal as in t1_cmap_custom_init() this still gets cmap->count assigned to 1 which is not really right (.notdef glyphs are excluded here, so we expect 0 here).

IMHO it would be better to have a slightly different meaning for T1_EncodingRecRec_::code_last as the last valid character code plus one. This deals better with fonts without valid characters (so no +32000/-32000 initialisation is needed). I've attached such a patch (including a Type42 change which has similar code but fails more badly when not valid character codes are defined).

John Tytgat <joty>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #18621:  cmap.patch added by joty (5KiB - 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 joty (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 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 01 Sep 2009 06:12:35 AM UTCwlStatusNone=>Fixed
      Assigned toNone=>wl
      Open/ClosedOpen=>Closed
      Planned ReleaseNone=>2.3.10
    Fri 21 Aug 2009 03:29:17 PM UTCjotyAttached File-=>Added cmap.patch, #18621

    Back to the top


    Powered by Savane 3.1-cleanup1