bugThe FreeType Project - Bugs: bug #44629, 4 glyphs cannot be loaded in a...

 
 

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

bug #44629: 4 glyphs cannot be loaded in a font extracted from iOS

Submitter:  Jean-Baptiste NOEL <perenono>
Submitted:  Wed 25 Mar 2015 02:18:08 PM UTC
   
 
Severity:  3 - Normal Item Group:  Incorrect behaviour
Status:  Fixed Privacy:  Public
Assigned to:  wl Open/Closed:  Closed
Planned Release:  2.6.0

Jump to the original submission

Sat 04 Apr 2015 10:17:38 PM UTC, comment #13: 

Thanks.  If you ever get a response, please add the results here.

Werner LEMBERG <wl>
Group administrator
Fri 03 Apr 2015 07:21:03 AM UTC, comment #12: 

I wrote a bug report to Apple on march 31st, 2015 : 20359784:

Summary:
It seems that `HiraKakuProN-W3.ttf' included in iOS 8.2 on my iPhone 5 A1429 (Hiragino Kaku Gothic ProN W3; 8.2d6e1; 2014-12-19) needs eleven nesting levels for 4 glyphs (18736 / 19847 / 19848 / 19850). This Dainippon font violates the CFF specification : The spec (Type 2 Charstring Format, #5177, Appendix B) says "Subr nesting, stack limit 10" (http://partners.adobe.com/public/developer/en/font/5177.Type2.pdf page 33)

Steps to Reproduce:
It's impossible to load these 4 glyphs using latest FreeType (2.5.5)
See the bug report at FreeType team : https://savannah.nongnu.org/bugs/?44629

Expected Results:
The font should respect the spec.

Actual Results:
The font doesn't respect the spec. Unable to use this font on device with FreeType. On desktop, using this iOS font, the 4 glyphs are not rasterized in Adobe Photoshop... It should also an issue with PDF files build on iOS using this font when read on other platforms.

Version:
iOS 8.2

Notes:


Configuration:
iPhone 5 A1429 64Go

Attachments:

Jean-Baptiste NOEL <perenono>
Thu 02 Apr 2015 08:27:14 PM UTC, comment #11: 

We got info from Apple that they are aware of the problem, and that a fix is in the works.

Werner LEMBERG <wl>
Group administrator
Mon 30 Mar 2015 02:45:07 PM UTC, comment #10: 

Thanks for testing.

Since Adobe Photoshop can't display the font correctly, it deserves a bug report to Apple and/or Dainippon!  I can imagine that people are trying to create PDFs on the iOS platform, which in turn can't be correctly displayed...

I hope that 2.6.0 will be released within a month.

Werner LEMBERG <wl>
Group administrator
Mon 30 Mar 2015 02:02:41 PM UTC, comment #9: 

I have tested the font in Adobe Photoshop CC 2014 :
- with the font extracted from iOS (the one with the issue) U+8E39 is not rasterized : nothing is drawn... (for testing purposes, U+8E38 is rasterized correctly)
- with the original font of OSX 10.10.2 U+8E39 is rasterized correctly
Adobe Photoshop seems to have the same issue with this font file...
It 's more complicated to test in MS Word (2011 for mac) because the font names are not displayed and it's pretty hard to select the right font out of the other asiatic fonts...
I'm waiting for the fix in 2.6.0. When do you plan to release it ?

Jean-Baptiste NOEL <perenono>
Sun 29 Mar 2015 12:49:21 PM UTC, comment #8: 

I've now set the maximum number of nesting levels to 16 in both the old and new CFF engine.

Werner LEMBERG <wl>
Group administrator
Fri 27 Mar 2015 08:24:15 AM UTC, comment #7: 

Well, there is no bug at all!  After adding some nesting information to FreeType's logging output it seems that `HiraKakuProN-W3.ttf' (Hiragino Kaku Gothic ProN W3; 8.2d6e1; 2014-12-19) needs eleven nesting levels!  Below is the relevant output; for the other three problematic glyphs the log data is similar.

If my analysis is correct, this Dainippon font violates the CFF specification.  However, I'm quite sure that other Adobe (and MS) environments render this font just fine – this means that the nesting level is higher in those environments.  Jean-Baptiste, can you please check this my assumption?  Can Acroread and MS Word display the missing glyphs?  For example, glyph 18736 is character U+8E39 (踹).

Consequently, my suggestion is still to increase CF2_MAX_SUBR – FreeType's old CFF engine sets this value to 32, BTW.


======================================================================


cff_glyph_load: glyph index 18736
  in subfont 11:
 -63 57 279 54 -39 52 106 55 -13 52 47 52 96 54 hstemhm
 81 5292 callsubr (idx 6423, entering level 1)
 57 -50 55 71 57 42 56 return (leaving level 1)
 66 60 -50 61 68 58 9 61 17 58 68 61 -39 60
 cntrmask (maskbytes: 0x35 0x2A 0x80)
 cntrmask (maskbytes: 0x0A 0xC5 0x40)
 hintmask (maskbytes: 0x4E 0xE0 0x00)
 214 -1126 callsubr (idx 5, entering level 1)
 65 -787 callsubr (idx 344, entering level 2)
 330 callsubr (idx 1461, entering level 3)
 1479 callsubr (idx 2610, entering level 4)
 rmoveto
 -20 -6 -25 -6 -26 2044 callsubr (idx 3175, entering level 5)
 -6 2231 callsubr (idx 3362, entering level 6)
 rrcurveto
 261 8611 callsubr (idx 9742, entering level 7)
 vlineto
 32 1 23 4 26 vhcurveto
 -65 hlineto
 return (leaving level 7)
 3 -28 6127 callsubr (idx 7258, entering level 7)
 2 -25 -30 vvcurveto
 -272 vlineto
 -40 -7 -1 0 -24 -3 17 -68 rcurveline
 26 9 10 3 39 11 return (leaving level 7)
 return (leaving level 6)
 return (leaving level 5)
 return (leaving level 4)
 108 28 74 23 114 42 -2 57 rcurveline
 -55 -21 -55 -19 -28 -8 rrcurveto
 return (leaving level 3)
 -749 callsubr (idx 382, entering level 3)
 192 500 callsubr (idx 1631, entering level 4)
 923 callsubr (idx 2054, entering level 5)
 1133 callsubr (idx 2264, entering level 6)
 2768 callsubr (idx 3899, entering level 7)
 3501 callsubr (idx 4632, entering level 8)
 26 13181 callsubr (idx 14312, entering level 9)
 vlineto
 31 27 -2 -3 26 -544 callgsubr (idx 587, entering level 10)
 hvcurveto
 64 vlineto
 -4 return (leaving level 10)
 -20 -703 callgsubr (idx 428, entering level 10)
 -24 51 callgsubr (idx 1182, entering level 11)              <-----
 -1 -40 hhcurveto
 return (leaving level 11)
 ...

Werner LEMBERG <wl>
Group administrator
Thu 26 Mar 2015 04:40:07 PM UTC, comment #6: 

I've just tried with 2.5.0.1, and it is not able to load those four glyphs (with the new CFF engine, that is).

It's a off-by-one bug, to be fixed soon.

Werner LEMBERG <wl>
Group administrator
Thu 26 Mar 2015 10:30:18 AM UTC, comment #5: 

The CF2_MAX_SUBR was already set to 10 in FreeType 2.5.0 which was able to load these 4 glyphs.

Jean-Baptiste NOEL <perenono>
Thu 26 Mar 2015 09:23:11 AM UTC, comment #4: 

I can reproduce the bug, thanks.  CCing Dave Arnold.

For glyph 18736, the problem is in routine `cf2_arrstack_setNumElements', which emits a `Stack_Overflow' error because the subroutine nesting level (value 10) is exceeded.

The fix is trivial, namely to increase CF2_MAX_SUBR in file `cf2_font.h'.  The only question is to what value...  Dave, please advise.

Werner LEMBERG <wl>
Group administrator
Thu 26 Mar 2015 08:03:55 AM UTC, comment #3: 

I have sent the font file in a private email. Thanks !

Jean-Baptiste NOEL <perenono>
Wed 25 Mar 2015 02:34:03 PM UTC, comment #2: 

You should never upload copyrighted fonts!  Please send it to me privately instead for further inspection.  I suspect that one of the many security checks added to FreeType is too strict.

Werner LEMBERG <wl>
Group administrator
Wed 25 Mar 2015 02:24:53 PM UTC, comment #1: 

I haven't been able to upload the font file 6,3Mo...

Jean-Baptiste NOEL <perenono>
Wed 25 Mar 2015 02:18:08 PM UTC, original submission:  

FreeType is unable to load 4 glyphs from the font HiraKakuProN-W3.ttf extracted from iOS 8.2 on an iPhone 5 (FreeType fails with code 3 and message "broken file"). Indexes for these glyphs are 18736 / 19847 / 19848 / 19850. FreeType was able to load these 4 glyphs in FreeType 2.5.0 and previous. Version 2.5.1 (and followings), have introduced the issue with these 4 glyphs.
ftview skips these 4 glyphs (from version 2.5.1) but they are displayed correctly in version 2.5.0 (and previous).
(included files : font, ftview screenshots for index 18736 with 2.5.0 and 2.5.5)

Jean-Baptiste NOEL <perenono>

 

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

Attached Files
file #33448:  18736-FT2-5-5.tiff added by perenono (104KiB - image/tiff)
file #33449:  18736-FT2-5-0.tiff added by perenono (91KiB - image/tiff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wl
  • -email is unavailable- added by wl (Posted a comment)
  • -email is unavailable- added by perenono (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-29 wl Open/ClosedOpen Closed
        Planned ReleaseNone 2.6.0
    2015-03-29 wl StatusNeed Info Fixed
    2015-03-28 wl StatusConfirmed Need Info
    2015-03-26 wl Carbon-Copy- Added darnold
    2015-03-26 wl StatusNeed Info Confirmed
    2015-03-25 wl StatusNone Need Info
        Assigned toNone wl
    2015-03-25 perenono Attached File- Added 18736-FT2-5-5.tiff, #33448
        Attached File- Added 18736-FT2-5-0.tiff, #33449

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code