poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54904] autoSizeColumn doesn't work with new JDK/JRE 1.6.45 or 1.7.21
Date Thu, 23 May 2013 07:40:42 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=54904

--- Comment #4 from jens.popp@process-relations.com ---
To test your JRE use this bit of code. It prints the font name and a number. If
the number is 0.0 than autosize won't work for that font.


final java.awt.GraphicsEnvironment gEnv =
    java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment();
final String envfonts[] = gEnv.getAvailableFontFamilyNames();
for(String font : envfonts) {
    final String txt = "Test";
    final java.text.AttributedString str = new java.text.AttributedString(txt);
    str.addAttribute(java.awt.font.TextAttribute.FAMILY, font, 0,
txt.length());
    str.addAttribute(java.awt.font.TextAttribute.SIZE, (float) 14.0);
    str.addAttribute(java.awt.font.TextAttribute.WEIGHT,
java.awt.font.TextAttribute.WEIGHT_BOLD, 0, txt.length());
    final java.awt.font.FontRenderContext fontRenderContext = new
java.awt.font.FontRenderContext(null, true, true);
    final java.awt.font.TextLayout layout = new
java.awt.font.TextLayout(str.getIterator(), fontRenderContext);
    System.out.println(font + " : " + layout.getBounds().getWidth());
}

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message