This is one way to get a FontMetrics object w/o a Graphics object

StyleContext context = StyleContext.getDefaultStyleContext();
Font font = new Font(...);
FontMetrics fm = context.getFontMetrics(font);

----- Original Message -----
From: "Rainer Klute" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "Rainer Klute" <[EMAIL PROTECTED]>
Sent: Thursday, March 07, 2002 4:23 PM
Subject: Re: FontMetrics from HSSFFont?


"D. Alvarado" <[EMAIL PROTECTED]> wrote:
>... But now it gets tricky.  There is no method in Font that returns a
FontMetrics
>object.

You need your Graphics instance. It has a getFontMetrics(Font) method.


>I suppose now I'm venturing into pure Java territory, and perhaps outside
the scope of
>this newsgroup/mailing list.

Who cares. (Well, Andy perhaps. :-))


Best regards
Rainer Klute

                             RAINER KLUTE IT-CONSULTING
  Dipl.-Inform.
  Rainer Klute               E-Mail:  [EMAIL PROTECTED]
  Körner Grund 24            Telefon: +49 172 2324824
D-44143 Dortmund             Telefax: +49 231 5349423


Reply via email to