public static RowParameters calculateOptimalFontHeight(Font f, int rowHeight) {
		Graphics g2 = new BufferedImage(rowHeight, rowHeight, BufferedImage.TYPE_INT_RGB).createGraphics();
		g2.setFont(f);
		FontMetrics fm = g2.getFontMetrics();
		double shrink = ((double)rowHeight / (double)fm.getHeight());
		double newSize = rowHeight * shrink;
		double newAsc  = fm.getAscent() * shrink;
		double heightDiff = fm.getAscent() - newAsc;
		f = f.deriveFont((float)newSize);
		return new RowParameters(-1, false, newAsc, f, heightDiff);
	}