At 29.04.2002 10:17, you 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. 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?
The chance that this works, even if you would have an algorithm is nearly null, as you donīt know which fonts are installed on the client, nor which version they have. Also what if the user disables JavaScript, then your nice css-stuff will not work either. To have text output to a specified length, you have to make it using gd. Then you are able to make a picture, containig the text you want . From this, you know itīs dimensions. but donīt forget the alt= attribute for people who have "load graphics" set off, or are not able to see graphics. HTH Oliver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php