Embedding fonts and bad /BBox errors

584 views
Skip to first unread message

Joel Chippindale

unread,
Apr 1, 2008, 6:30:11 AM4/1/08
to pdf-w...@googlegroups.com
I followed the instructions (http://www.markvera.net/blog/2006/10/17/ruby-pdf-writer-113-and-embedding-fonts/#comment-7182) for creating the appropriate afm and pfb files for embedding a font in a PDF and am using http://stonecode.svnrepository.com/svn/ruby_pdf/pdf-writer/branches/1.1/ r202 (which as I understand it includes fixes for font embedding) BUT I still get a 'bad /BBox' error when I open the PDF I have generated.

I have attached an example of the generated PDF with an embedded font, I would really appreciate any suggestions for how to resolve this problem.

J.
example.pdf

Austin Ziegler

unread,
Apr 1, 2008, 7:36:28 AM4/1/08
to pdf-w...@googlegroups.com

Here's the comments that I had that were related to where PDF::Writer came from:

14 - I get an error which says bad value for BBOX in font!

This error almost always occurs because there is some problem
reading or accessing the
font files, ensure that:

* the files are all in the right place (usually in a fonts folder
below the class location)
* the web server has access to the files (has at least read rights
to the files)
* the web server may also need write access to the folder to make
the php_ files
* ensure that the case of the files is the same as the originals,
this is especially important
for the 14 standard fonts.
* if adding your own ttf or pfb fonts, then the suffix needs to be
lower case, and the
for the .pfb file (or .ttf file) must be identical to that in
the .afm file.

-austin
--
Austin Ziegler * halos...@gmail.com * http://www.halostatue.ca/
* aus...@halostatue.ca * http://www.halostatue.ca/feed/
* aus...@zieglers.ca

rpd

unread,
Apr 2, 2008, 8:23:05 AM4/2/08
to PDF::Writer
Two things that have worked for me, using an unpatched copy of
PDF::Writer version 1.1.8:

1) I use fontforge (http://fontforge.sourceforge.net/) to convert
Adobe otf files into afm and pfb files. Other tools have given me a
font that causes BBOX error messages.

2) When I call select_font, I use "fontname.afm", not just "fontname".

Good luck!

--Rick Daley

On Apr 1, 7:36 am, "Austin Ziegler" <halosta...@gmail.com> wrote:
> On Tue, Apr 1, 2008 at 6:30 AM, Joel Chippindale
>
> <joel.chippind...@gmail.com> wrote:
> > I followed the instructions
> > (http://www.markvera.net/blog/2006/10/17/ruby-pdf-writer-113-and-embed...)
> Austin Ziegler * halosta...@gmail.com *http://www.halostatue.ca/
>  * aus...@halostatue.ca *http://www.halostatue.ca/feed/
>  * aus...@zieglers.ca

Joel Chippindale

unread,
May 6, 2008, 9:19:57 AM5/6/08
to PDF::Writer
Thanks for the tip. Using "fontname.afm" and not just "fontname"
worked well and pdf-writer picked up the font correctly.

However that revealed another problem, everywhere I have a carriage
return in my text a box outline appears in the PDF when viewed in
Adobe Acrobat Reader (although not in OS X's Preview app), so I'm
still not able to use the fonts correctly. Anyone have any idea what
the problem might be here?

J.

Gregory Brown

unread,
May 6, 2008, 9:43:24 AM5/6/08
to pdf-w...@googlegroups.com
On Tue, May 6, 2008 at 9:19 AM, Joel Chippindale
<joel.chi...@gmail.com> wrote:
>
> Thanks for the tip. Using "fontname.afm" and not just "fontname"
> worked well and pdf-writer picked up the font correctly.
>
> However that revealed another problem, everywhere I have a carriage
> return in my text a box outline appears in the PDF when viewed in
> Adobe Acrobat Reader (although not in OS X's Preview app), so I'm
> still not able to use the fonts correctly. Anyone have any idea what
> the problem might be here?

How are you saving the file? If you are manually using File.open, be
sure to use "wb".

I have not tested to see how \r is handled in the text functions. If
you can, please put togehter a simple script that will reproduce the
problem, and attach that along with the outputted PDF in the tracker:

http://stonecode.svnrepository.com/ruby_pdf

Joel Chippindale

unread,
May 6, 2008, 10:03:21 AM5/6/08
to PDF::Writer
Thanks for the tip. Using "fontname.afm" and not just "fontname"
worked well and pdf-writer picked up the font correctly.

However that revealed another problem, everywhere I have a carriage
return in my text a box outline appears in the PDF when viewed in
Adobe Acrobat Reader (although not in OS X's Preview app), so I'm
still not able to use the fonts correctly. Anyone have any idea what
the problem might be here?

J.

On Apr 2, 1:23 pm, rpd <r...@stolenbases.com> wrote:
Reply all
Reply to author
Forward
0 new messages