How to obtain the fontmatrix without graphics? I want to get the font matrix in the constructor, now I do this:
BufferedImage bi = new BufferedImage (5, 5, BufferedImage.TYPE_INT_RGB); Font Matrix FM = ByeGraphics (). GetFontMetrics (font); Int width = fm.stringWidth (pattern); Int height = fm.getHeight ();
Hmm ... it's quite logical that you have the graphics to get the fontmatics the wanted. Font height, width, etc. may vary on different displays.
If you have some components, you can use it to get the font metric:
component.getFontMetrics (font);
Comments
Post a Comment