Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Centering Text with GD::Image

by Fletch (Bishop)
on Nov 03, 2021 at 19:45 UTC ( [id://11138405]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11138405]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-18 18:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found