Re: Pixel Length of text message
| From: | Jason Wong | Date: | Mon, 29 Apr 2002 16:31:46 +0000 |
| Subject: | Re: Pixel Length of text message | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-95191@lists.php.net to get a copy of this message | ||
On Tuesday 30 April 2002 00:17, District Webmaster wrote:
> 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.
That may (or may not) be true, but that's referring to the height of the font.
> 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?
Here I would assume you're referring to the width of the text. Thus what you
want to do is not possible.
You can use a fixed-width font and hope for the best.
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
If the very old will remember, the very young will listen.
-- Chief Dan George
*/