://www.vividmedia.com/
608.270.9770
_
From: Burns, John D [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 3:10 PM
To: CF-Talk
Subject: RE: Determining physical length of text string (not char count)
I haven't been paying much attention today, so I'm not 100% sure what's
been said
If you're not scared of Java, one approach would be to use the
java.awt.FontMetrics class (probably via a temp image's Graphics
instance), specifically the getStringBounds method.That'll give you
all kinds of goodies about the font and strings written using that
font.
If you don't want that
So if I understand you correctly you need to know how long some text is, not
the number of letters that makes it up.
Just off the top of my head, if you know the font and point size you will be
using in the PDF, you could build a look up table for each letter and return
the pix with then add
variations (bold/italic).I'm hoping to avoid that. :)
Thanks!
Dirk
-Original Message-
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 9:25 AM
To: CF-Talk
Subject: SUSPECT: Re: Determining physical length of text string
(not char count)
If you're
it.
Dirk
-Original Message-
From: Mark W. Breneman [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 9:34 AM
To: CF-Talk
Subject: SUSPECT: RE: Determining physical length of text string
(not char count)
So if I understand you correctly you need to know how long some
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().getFontMetrics(font_obj);
Pixel_Width = font_metrics_obj.stringWidth('My co-worker is mean');
Two reasons.First FontMetrics has a protected constructor, so only
it's subclasses can call it.Second, it's an abstract class, so even
if it had a public constructor, you still couldn't instantiate it.
That method of getting a FontMetrics object is a heck of a lot better
than my temp image idea,
oh I see what your talkin' about I completely missed that in the doc I
was looking at for the class :) Thanks for clearing that up for me.
Adam H
On Wed, 11 Aug 2004 12:46:55 -0700, Barney Boisvert [EMAIL PROTECTED] wrote:
Two reasons.First FontMetrics has a protected constructor, so only
width attribute so maybe that would help some.It'd be a
little extra work to get that variable into CF, but it seems doable.
John
-Original Message-
From: Adam Haskell [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 3:22 PM
To: CF-Talk
Subject: Re: Determining physical length
: 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
: 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
11 matches
Mail list logo