Adam,

That's perfect - thank you! It does exactly what we're looking for.
We've rolled it into a function, and it's working perfectly.

Many thanks!
Dirk

-----Original Message-----
From: Adam Haskell [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 12:22 PM
To: CF-Talk
Subject: SUSPECT: Re: Determining physical length of text string (not
char count)

I came up with this (you could easily turn it into a function):

font_obj = createobject("java","java.awt.Font").init('Tahoma',1,8);
font_metrics_obj =
createobject("java","java.awt.Toolkit").getDefaultToolkit().getFontMetri
cs(font_obj);
Pixel_Width = font_metrics_obj.stringWidth('My co-worker is mean');

I have a question though....I tried to do
createobject("java","java.awt.FontMetrics").init(font_obj)  and it
gave me an error:
Unable to find a constructor for class java.awt.FontMetrics that
accepts parameters of type ( java.awt.Font )

Any ideas what I was doing wrong?

Adam H
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to