List of utility methods to do Font Text Height
int | getStringDrawingHeight(Graphics graphics, String string) get String Drawing Height Rectangle2D rect = graphics.getFontMetrics().getStringBounds(string, graphics); return (int) rect.getHeight() - graphics.getFontMetrics().getDescent(); |
int | getStringHeight(Component c) Returns the height of the given component. FontMetrics metrics = c.getFontMetrics(c.getFont()); int hgt = metrics.getHeight(); return hgt + 2; |
double | getStringHeight(Graphics2D g, String str) get String Height FontRenderContext frc = g.getFontRenderContext();
GlyphVector gv = g.getFont().createGlyphVector(frc, str);
return gv.getPixelBounds(null, 0, 0).getHeight();
|
float | getStringHeight(Graphics2D graphics2D) get String Height FontMetrics fontMetrics = graphics2D.getFontMetrics();
return fontMetrics.getHeight();
|
int | getTextHeight(String s, FontMetrics fm, Graphics g) get Text Height return (int) Math.ceil(fm.getLineMetrics(s, g).getHeight()); |
int | getTextHeight(String text, Graphics g, String newLineSplit) get Text Height return g.getFontMetrics().getHeight() * text.split(newLineSplit).length;
|
int | stringHeight(Graphics2D g2d) string Height FontMetrics fm = g2d.getFontMetrics(g2d.getFont());
return fm.getHeight();
|