What I'm thinking is trying to avoid determining the
text width by creating an image of just the text and
measuring that.

Once you have that width information, you can use it
to determine how to center the text when you apply it
to the background image.

Such as:

Here's your text:

MyText

Create an image of just that text:

--------
|MyText|
--------

and determine width:  220px


Here's your background:

-----------------
|               |
-----------------

Background image width: 540px

Difference:  540px - 220px = 320px

Half that is left offset:  160px

Use that info (160px) as the basis for centering your text.

Does that make sense?

I know you can get the width of an image using javascript (jQuery recommended),
but the others have also pointed to some other potential resources... CFC's, 
etc.

Hope this helps...I'm going to need a solution to this at some point, too!

(Realize I haven't worked with applying text to images, yet,
so my approach may be totally off-base.  Just thinking out loud...which may
be a bad idea before coffee :o)

Rick


> -----Original Message-----
> From: Kevin Roche [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 26, 2008 8:43 AM
> To: CF-Talk
> Subject: Re: Centering text written on an image
> 
> >Is there a way to add an extra step or two and make
> >an image of just your text, determine that width which
> >gives you your string width
> 
> I have no Idea how to do that. Can you tell me how to find the width of the 
> text?
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311561
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to