Does anyone have an easy way to calculate how many points across a page a piece of text will consume in a particular font and size? (easy = minimal lines of code + computationally cheap). Zend_Pdf doesn't appear to have a function that does this, except for some very expensive calls for each character to getGlyphForCharacter(), getUnitsPerEm() and getWidthsForGlyph().
I'm generating a multi page PDF with several tables on each page, and need to wrap the text within the columns. It's already taking a few seconds to create it, and I don't want it to take too much longer or I'll have to start messing around with background tasks or progress bars etc.
The only solution I came up with is pre-computing the width (in points) of each character in each font size used, then adding these up over each string. Still quite costly.
Am I missing something? Or have you got anything simpler?
thanks!