FULL PRODUCT VERSION : Java 1.6.0 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode ADDITIONAL OS VERSION INFORMATION : Windows XP Windows Vista A DESCRIPTION OF THE PROBLEM : Our customer is Motorola and they have their own Motorola font. When we call getFontMetrics on the Mortorola font, Java hangs. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : I have the Motorola font. Please email me for the font. Run the test code with Motorola7.ttf in the Windows\Fonts directory. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - Not a hang. REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import javax.swing.*; import java.awt.Font; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; public class fontbug { public static void main(String args[]) { GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); String[] fonts = env.getAvailableFontFamilyNames(); String thisFont; Font testFont; JPanel testPanel = new JPanel(); for (int i = 0; i < fonts.length; i++) { thisFont = fonts[i]; if (thisFont != null && !thisFont.equals("")) { System.out.println("Font name = " + thisFont ); // Use a plain style and size 10, just to see if the font has a width or height. testFont = new Font(thisFont, Font.PLAIN, 10); if (testPanel.getFontMetrics(testFont).charWidth('n') != 0 && testPanel.getFontMetrics(testFont).getHeight() != 0 ) { } } } } } ---------- END SOURCE ----------
|