FontMetrics

Hy,

I need a way to get the FontMetrics of a Font, but I don't have a Graphics-Object. If I understand it correctly it needs the Graphics-Object, so that it can give correct/optimal FontMetrics for the Device it is about to be rendered. I have to embedd the Font into a File (a Flash-SWF to be exact) and need the FontMetrics for this File. Is there a way to either

1.) get a FontMetrics-Object (or a similar Object with the same Information, ideally as float/double and not as ints) or

2.) create a Graphics Object, that does not represent any physical Device, which I can setup to fit the SWF-Output as closely as possible?

[659 byte] By [saua] at [2007-9-26 8:23:44]
# 1
Hi, you do not need a Graphics Object to get the FontMetrics for a font.You can get the FontMetrics from the Toolkit as follows...Toolkit.getDefaultToolkit().getFontMetrics(<Font>);Hope this helps
msguillory at 2007-7-1 18:59:13 > top of Java-index,Desktop,Core GUI APIs...
# 2
Be careful about using sizes obtained via Java in Flash. Widths can be different depending on whether anti-aliasing is used or not. Flash, as I have seen, anti-aliases text.
ashutosh at 2007-7-1 18:59:13 > top of Java-index,Desktop,Core GUI APIs...