Hi,
I'm drawing text in Graphics2D by setting a font with AttributedString (see
code below)
AttributedString as = new AttributedString(text);
as.addAttribute(TextAttribute.FAMILY, textElement.getFontName());
as.addAttribute(TextAttribute.SIZE,new Float(textElement.getFontSize()));´
My Question: is there any possibilty to get the width of the text before
it's drawing?
I tried the "normal" way by using a new Font object, but i was'nt able to
underline text, so i had to take
the AttributedString solution.
best regards Andreas
Hal Rosser - 04 Aug 2004 05:47 GMT
look at the fontmetrics class
> Hi,
>
[quoted text clipped - 12 lines]
>
> best regards Andreas
Christian Kaufhold - 05 Aug 2004 18:01 GMT
> I'm drawing text in Graphics2D by setting a font with AttributedString (see
> code below)
[quoted text clipped - 8 lines]
> underline text, so i had to take
> the AttributedString solution.
java.awt.font.TextMeasurer
java.awt.font.TextLayout
Christian