I am not the person to give a definitive answer, but have you tried the
FontMetrics class? I get the total width and height of a string with
the following code:
int sw = g2d.getFontMetrics().stringWidth(text);
int sh = g2d.getFontMetrics().getHeight();
I notice there is also a getMaxCharBounds in this class. It uses a
Graphics context instead of FontRenderContext.
Hope this helps.
bill
Michele Puccini wrote:
Hello,
I have some questions:
1) how to determine the max pixel with of the characters in a font ?
Font.getMaxCharBounds() does not return correct values (expecially
with some
italic fonts). A silly workaround is to find the max size of the chars
glyph
outlines bounds.. But it's so ugly!
2) why Graphics2D.drawString() gives so different visual results from
drawing a glyphVector as a Shape ?
Many thanks,
Mik
============================================================================
ClassX Development Italy Via Francesca, 368/I I-56030 S.M. a Monte
(PI) <
Tel.(+39)-0587-705153 Fax.(+39)-0587-705153 WEB:
http://www.classx.it <
============================================================================
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
of the message "signoff JAVA2D-INTEREST". For general help, send
email to
[EMAIL PROTECTED] and include in the body of the message "help".
.
--
Bill Dodson
Parkline, Inc. http://www.parkline.com
phone: 304-586-2113 x149
fax: 304-586-3842
email: [EMAIL PROTECTED]
Email Disclaimer
The information in any email is confidential and may be legally privileged. It
is intended solely for the addressee. Access to the email message by anyone
else is unauthorized. If you are not the intended recipient, any disclosure,
copying, or distribution of the message, or any action or omission taken by you
in reliance on it, is prohibited and may be unlawful. If you have received an
email message in error, please notify the sender immediately by email,
facsimile or telephone and return and/or destroy the original message.
Thank you.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".