Re: Pixel Length of text message
| From: | Jan Peuker | Date: | Mon, 29 Apr 2002 16:51:50 +0000 |
| Subject: | Re: Pixel Length of text message | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95199@lists.php.net to get a copy of this message | ||
Font-size is the height of text, the width is changing w/ every font (e.g. i
and m).
If you use exactly one font, you may use an array of widths(which you
measured before), but that's not really exact.
Perhaps, a way would be to use temporarly gd (ttfbox and/or imagefontwidth),
but I don't know how exactly, it's just an idea,
regards,
jan
----- Original Message -----
From: "District Webmaster" <webmaster@alpine.k12.ut.us>
To: <php-general@lists.php.net>
Sent: Monday, April 29, 2002 6:17 PM
Subject: [PHP] Pixel Length of text message
> In html/css you can set a font size in pixels -- in my experience this
> means a letter takes the same number of pixels, regardless of
> resolution. With php, can I use string length and font pixel size to
> determine the length of a given string on a screen? Does anyone know an
> algorithm for this that works for any/every font?
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>