Issue Details (XML | Word | Printable)

Key: ZF-1874
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Alexander Veremyev
Reporter: Alexander Veremyev
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_Pdf fails with some freware TTF fonts

Created: 23/Aug/07 08:49 AM   Updated: 21/Mar/08 04:25 PM   Resolved: 06/Dec/07 06:55 PM
Component/s: Zend_Pdf
Affects Version/s: 1.0.1
Fix Version/s: 1.5.0

Time Tracking:
Original Estimate: Not Specified
Remaining Estimate: 0 minutes
Remaining Estimate - 0 minutes
Time Spent: 4 days
Time Spent - 4 days

File Attachments: 1. File New.ttf (9 kB)



 Description  « Hide

Zend_Pdf fails with some freware barcode fonts (http://www.squaregear.net/fonts/free3of9.shtml).

It throws an exception:

Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Glyph number is out of range: 81' in /home/cawa/ZendFramework/trunk/library/Zend/Pdf/Resource/Font.php:477
Stack trace:
#0 /home/cawa/ZendFramework/trunk/library/Zend/Pdf/Resource/Font/OpenType.php(147): Zend_Pdf_Resource_Font->widthsForGlyphs(Array)
#1 /home/cawa/ZendFramework/trunk/library/Zend/Pdf/Resource/Font/OpenType/TrueType.php(53): Zend_Pdf_Resource_Font_OpenType->__construct(Object(Zend_Pdf_FileParser_Font_OpenType_TrueType), 0)
#2 /home/cawa/ZendFramework/trunk/library/Zend/Pdf/Font.php(720): Zend_Pdf_Resource_Font_OpenType_TrueType->__construct(Object(Zend_Pdf_FileParser_Font_OpenType_TrueType), 0)
#3 /home/cawa/ZendFramework/trunk/library/Zend/Pdf/Font.php(637): Zend_Pdf_Font::_extractTrueTypeFont(Object(Zend_Pdf_FileParserDataSource_File), 0)
#4 /home/cawa/ZendFramework/laboratory/Pdf/BarCodeFonts/test1.php(15): Zend_Pdf_Font::fontWithPath('./FRE3OF9X.TTF')
#5 {main}
  thrown in /home/cawa/ZendFramework/trunk/library/Zend/Pdf/Resource/Font.php on line 477

The interesting thing is that if this font is converted to another format and then back to the TTF, then it works proper.



Alexander Veremyev added a comment - 23/Aug/07 08:49 AM

An example of converted font


Mike Bowie added a comment - 28/Aug/07 01:49 PM

Interestingly enough, I've been hanging out to post the same issue regarding 'Courier New'. (COUR.TTF)

Aug 28 11:36:34 www3 httpd: PHP Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Glyph number is out of range: 3' in /usr/local/www/strongaero.com/includes/Zend/Pdf/Resource/Font.php:477
Stack trace:
#0 /usr/local/www/strongaero.com/includes/Zend/Pdf/Resource/Font/OpenType.php(147): Zend_Pdf_Resource_Font->widthsForGlyphs(Array)
#1 /usr/local/www/strongaero.com/includes/Zend/Pdf/Resource/Font/OpenType/TrueType.php(53): Zend_Pdf_Resource_Font_OpenType->_construct(Object(Zend_Pdf_FileParser_Font_OpenType
(Trace truncated thanks to syslog)

I'll try converting it to pfa and back and see if it helps; sadly I'm not sufficiently familiar with TTF and company to know where to start for a patch.

Much as I'd love to post a copy of the font, I don't think Microsoft class it as freeware just yet.

Cheers,

Mike.


Alexander Veremyev added a comment - 28/Aug/07 02:59 PM

Thanks for the info Mike!

Could you also attach font to the issue (if it's allowed by font license)?


Mike Bowie added a comment - 28/Aug/07 03:55 PM

Alexander,

It would seem they are available for download from http://umn.dl.sourceforge.net/sourceforge/corefonts/courie32.exe (As I understand it, the license does not allow distribution other than in their original form.)

The file can be extracted using cabextract on non-Windows platforms.

cour.ttf in that particular package is 2.82, which exhibits the behavior; as does 2.9, which I tried from one of the local Windows XP installations.

Hope that helps,

Mike.


Philip Iezzi added a comment - 08/Nov/07 12:16 PM

I'm encountering the same issue with the freeware OCR-B font from http://ansuz.sooke.bc.ca/software/ocrb.php
Any solution to this problem so far?
If not, is there any other freeware OCR font that works with Zend_Pdf_Resource_Font?


Alexander Veremyev added a comment - 06/Dec/07 06:55 PM

There was a problem in glyph width array processing. It may contain less elements than glyphs are presented in the font.
Last element contains width for the rest of glyphs list.