Re: How do I find out if a string will fit in an area of an image?

From: Date: Wed, 25 Aug 2004 05:32:00 +0000
Subject: Re: How do I find out if a string will fit in an area of an image?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-194650@lists.php.net to get a copy of this message
* Thus wrote Brent Clements: > Hi All, > > > Let's say I have a string of text. > > $foo = "I WANT ALot of Text to be diSPLAYed!" > > I have an area on my image that is around 386 pixels wide. > > How do I find out if my text will fit in that area using any size font? This isn't as simple of a task as it would seem: - screen resolution - font in pixel size or point size - user has custom size fonts - what browser is being used. - how are dimensions define within the paticular font - Is this a TrueType font. If you have gd compiled on your system you might be able to fudge your calculation with: http://php.net/imagettfbbox Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#194650) next »