Issues

ZF-1874: Zend_Pdf fails with some freware TTF fonts

Issue Type: Bug Created: 2007-08-23T08:49:16.000+0000 Last Updated: 2008-03-21T16:25:33.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Alexander Veremyev (alexander) Assignee: Alexander Veremyev (alexander) Tags: - Zend_Pdf

Related issues: Attachments: - New.ttf

Description

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

It throws an exception:

<pre class="highlight">
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.

Comments

Posted by Alexander Veremyev (alexander) on 2007-08-23T08:49:56.000+0000

An example of converted font

Posted by Mike Bowie (mbowie) on 2007-08-28T13:49:21.000+0000

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.

Posted by Alexander Veremyev (alexander) on 2007-08-28T14:59:49.000+0000

Thanks for the info Mike!

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

Posted by Mike Bowie (mbowie) on 2007-08-28T15:55:57.000+0000

Alexander,

It would seem they are available for download from http://umn.dl.sourceforge.net/sourceforge/… (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.

Posted by Philip Iezzi (iezzip) on 2007-11-08T12:16:22.000+0000

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?

Posted by Alexander Veremyev (alexander) on 2007-12-06T18:55:06.000+0000

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.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts