42BV / pdf-library

Toucan-PDF
http://www.toucanpdf.org
9 stars 3 forks source link

Syntax error in font embedding #26

Closed DylanDeWolff closed 10 years ago

DylanDeWolff commented 10 years ago

When opening a PDF file generated by this library, Adobe Reader/Acrobat shows the following error message: "Cannot extract the embedded font 'insert font name'. Some characters may not display or print correctly."

The cause of this error is still unknown.

DylanDeWolff commented 10 years ago

The bug was caused by an incorrect size of the font widths array. PDF format expects an array the size of: (LastCharacterCode - FirstCharacterCode) + 1. Many of the character codes in between the last and first code are not used which caused the array size to be a lot smaller than expected. There were also some attributes missing for the .pfb embedding.