Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Font size by pixels.

by hanenkamp (Pilgrim)
on Dec 27, 2003 at 22:48 UTC ( [id://317238]=note: print w/replies, xml ) Need Help??


in reply to Font size by pixels.

UPDATE:Sorry Monks, I didn't explain why I needed this. I am creating pdf's and I need to calculate space for a certain part of a pdf document I am creating. So, the calculation by pixels will tell me how far I can go with the text, where the left position can start, and if I have to split the line into smaller parts. Thanks again.

Your update is a little confusing. Are you creating a vector or a raster document? PDFs are vector-based and do not use pixels. If you are creating a raster graphic to be embedded in a PDF, that's something different.

Simply answering your question, determining the length of text is a basic function of any text rasterization package. For example, GD returns the bounds of a string rendered with stringFT. More conveniently, you can use GD::Text to get the information a little more easily. Similar functionality is available with nearly any text rasterizer I'm aware of.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-26 00:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found