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

Microsoft Sans Serif (True Type) font is not rendered properly

XMLWordPrintable

    • 2d
    • b53
    • generic, x86
    • generic, windows_98, windows_2000, windows_xp

        Name: jk109818 Date: 09/17/2003


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


        FULL OPERATING SYSTEM VERSION :

        Windows Millennium [Version 4.90.3000]


        A DESCRIPTION OF THE PROBLEM :
        Clarification up front:

        "MS Sans Serif" (sserife.fon) is a bitmap font.
        Bitmap fonts are not supported by Java2D.

        "Microsoft Sans Serif" (micross.ttf) is a true type font.
        True type fonts ARE supported by Java2D.

        ---

        When using the "Microsoft Sans Serif" true type font at
        size 8 (Windows) / 11 (Java), certain characters/glyphs
        are not rendered properly by the Java2D system.

        Examples:

        CMQx89 (PLAIN)
        MQUWcoswxy0689,*~ (BOLD)

        The rendered glyphs for these characters look noticeably
        broken. As this is not Bugzilla, I cannot attach a screenshot
        of how they differ from the native rendering supplied by
        Windows.
        The correct look can be seen in a native Windows application
        such as Wordpad with the font set to "Microsoft Sans Serif",
        size 8.

        ---

        Additional points:

        * "Microsoft Sans Serif" is the font used by the Classic theme
         in Windows 2000. At size 8, it also looks identical to the
         old "MS Sans Serif" bitmap font that's been in use since
        Windows 95.
         "Microsoft Sans Serif" is what many users still use as their
         default font and without this bug being fixed there's no way
         to properly deploy it in a Swing application.

        * Again, this bug is not complaining about bitmap fonts or
          how those are substituted. Therefore, this is NOT a duplicate
          of bug 4640557.

        * Bug 4533223 fixed the issue of spaces displaying as dots
          but it did not fix the (other) broken glyphs.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the attached test case and compare the output
        to the native font rendering that can be seen in
        a native Windows app such as Wordpad with the font
        set to "Microsoft Sans Serif", size 8.


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        Expected: Glyphs should be indistinguishable from native
        rendering.

        Actual: Glyphs look broken.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.*;
        import javax.swing.*;

        public class MSFontTest extends JFrame {
          public MSFontTest() {
            super("MSFontTest");
            
            JPanel pnl = new JPanel();
            pnl.setLayout(new GridLayout());
            
            JTextArea textArea1 = new JTextArea();
            textArea1.setFont(new Font("Microsoft Sans Serif", Font.PLAIN, 11));
            textArea1.setText("Microsoft Sans Serif size 8 (Java: 11)\n\nCMQx89");
            pnl.add(new JScrollPane(textArea1));
            
            JTextArea textArea2 = new JTextArea();
            textArea2.setFont(new Font("Microsoft Sans Serif", Font.BOLD, 11));
            textArea2.setText("Microsoft Sans Serif size 8 (Java: 11)
        BOLD\n\nMQUWcoswxy0689,*~");
            pnl.add(new JScrollPane(textArea2));
            
            setContentPane(pnl);
            
            setSize(new Dimension(540, 100));
            
            show();
          }
          
          public static void main(String[] args) {
            new MSFontTest();
          }
        }
        ---------- END SOURCE ----------
        (Incident Review ID: 179626)
        ======================================================================


        ###@###.### 2004-01-15

        2 CAP members complains the about distorted text in
        Java Control Panel in the About section. Notice the
        "C" and "8" text.

              igor Igor Nekrestyanov (Inactive)
              jkimsunw Jeffrey Kim (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: