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,


----- Original Message -----
From: "District Webmaster" <[EMAIL PROTECTED]>
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 (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to