in reply to Centering Text with GD::Image
Prossibly you could use GD::Text::Wrap and/or reimplement what it does (which looks to be what I vaguely recall was the unfortunatly kludgy procedure: draw (but don't really draw) the text into a test image and then ask for the bounds afterwards).
Edit: Actually I think I'm misremembering something from ancient PostScript where that was the way to get the bounding box. Other answers using the font info are much better.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|