the_0ne has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Monks, have a question that I'm not sure can be answered easily. I'd like to be able to figure out the length of a string by pixels. I know this is a very hard question because there are a lot of parameters that come into play, like which font, OS, browser, blah, blah... But I'm trying to get at a more general answer. I'd like to be able to find out the length of the word WAS is greater in length, because of W usually being the largest font character, than was. So, it'd be great to have a function that would tell me 'WAS' is 20 pixels and 'was' is 15 pixels.
I did find a post while googling showing a person that tried it through a gimp module. But not sure if that's the best way, I've never even used the Gimp before.
Thanks in advance Monks...
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.