I’m working on creating PDF files in PHP with the R&OS PDF class (http://www.ros.co.nz/pdf) trying to add some more fonts to the output. It requires a TTF file and an AFM file for the metrics, but I can’t get around the “bad /BBox” error as referred to in this post: Generating .afm from .ttf
At first I thought it was that I wasn’t using properly made ttf files, but I’ve tried converting some fonts that I know are legit (Arial) and I still get the error, so now I think it must be the AFM conversion.
The Stack post above refers to http://fpdf.fruit-lab.de/ as a good conversion tool- maybe I’m just using the wrong mapping? Is there a specific map format the PDF prefers?
I ran into the same problem using dompdf http://code.google.com/p/dompdf/ which uses R&OS PDF Class for rendering so this may help you.
If you have a .ttf font skip to step 2.
I had problems with spaces so I used CamelCase and my .ttf extension was uppercase and my .afm extension was lower case. Once I made sure I had the .afm and .ttf named in CamelCase with no spaces and lower case extensions it worked!
This is probably dompdf specific, I then had to update dompdf_font_family_cache.dist.php and include my font in the array like so:
Note: I only wanted one version of the font – not bold, italic etc so I just made them all point to the same font file.