in reply to Font size by pixels.

I've done something like this using Image::Magick, which lends itself better to server-side CGIs, but I recommend you learn (much) about CSS, where you can set the width of elements in em, which is some character length depending on the font size.

If you still think you really need to know the "pixel size" of the rendered HTML, I suggest that you convert your text into images of differing width and calculate from there.

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web

Replies are listed 'Best First'.
Re: Re: Font size by pixels.
by the_0ne (Pilgrim) on Dec 27, 2003 at 21:57 UTC
    Thanks Corion, see my UPDATE to the original post. This is for a pdf document creation and not html. Sorry for the oversight.