Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5016993

REGRESSION: Lucida Console Bold is not monospaced as expected

XMLWordPrintable

    • 2d
    • mustang
    • x86
    • windows_2000



        Name: jl125535 Date: 03/19/2004


        FULL PRODUCT VERSION :
        java version "1.4.2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
        Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b43)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b43, mixed mode)

        FULL OS VERSION :
        Microsoft Windows 2000 [Version 5.00.2195]

        A DESCRIPTION OF THE PROBLEM :
        Lucida Console Bold is not monospaced as it should be (specifically space). Italic and Plain display as expected. The Bold font space character is not the same width as all of the other characters. This worked fine in 1.3.1_01.

        In my test case below I print out the char widths of some randomly chosen characters for Lucida Console Bold 10 and every char has a width of 7 except the space which has a width of 6.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        This is pretty easy to reproduce. Just create a JTextArea and set the font to Lucida Console Bold. The size of the font is irrelevant. In my test case below, I set it to 10.



        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        I expect all chars to be the same width with the Lucida Console Bold font.
        ACTUAL -
        Print out from running my diagnostic class:

        S:\test\class>java FontTester
        java.awt.Font[family=Lucida Console,name=Lucida Console,style=bold,size=10]
        Width of char c: 7
        Width of char n: 7
        Width of char w: 7
        Width of char N: 7
        Width of char W: 7
        Width of char X: 7
        Width of char Z: 7
        Width of char x: 7
        Width of char z: 7
        Width of char y: 7
        Width of char m: 7
        Width of char SPACE: 6


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------

        import javax.swing.*;
        import java.awt.*;

        public class FontTester extends JTextArea
        {
            private JTextArea fTextArea;
            public FontTester()
            {
                super();
                fTextArea = this;
                setFont(new Font("Lucida Console", Font.BOLD, 10));
                printCharWidths();
            }
            
            private void printCharWidths()
            {
                System.out.println(getFont().toString());
                FontMetrics fm = getFontMetrics(getFont());
                System.out.println("Width of char c: " + fm.charWidth('c'));
                System.out.println("Width of char n: " + fm.charWidth('n'));
                System.out.println("Width of char w: " + fm.charWidth('w'));
                System.out.println("Width of char N: " + fm.charWidth('N'));
                System.out.println("Width of char W: " + fm.charWidth('W'));
                System.out.println("Width of char X: " + fm.charWidth('X'));
                System.out.println("Width of char Z: " + fm.charWidth('Z'));
                System.out.println("Width of char x: " + fm.charWidth('x'));
                System.out.println("Width of char z: " + fm.charWidth('z'));
                System.out.println("Width of char y: " + fm.charWidth('y'));
                System.out.println("Width of char m: " + fm.charWidth('m'));
                System.out.println("Width of char SPACE: " + fm.charWidth(' '));
                System.exit(0);
            }
            
            public static void main(String[] args)
            {
                new FontTester();
            }
            
            
        }
        ---------- END SOURCE ----------

        Release Regression From : 1.3.1
        The above release value was the last known release where this
        bug was known to work. Since then there has been a regression.

        (Incident Review ID: 192501)
        ======================================================================

              igor Igor Nekrestyanov (Inactive)
              jleesunw Jon Lee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: