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

Garbled text when using 13pt monospaced font in Java when locale set to Chinese.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3
    • None
    • 7u17
    • client-libs

    Description

      FULL PRODUCT VERSION :
      1.7.0_17

      ADDITIONAL OS VERSION INFORMATION :
      Windows 7 Professional 64-bit English

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      System locale set to Simplified Chinese (PRC)

      A DESCRIPTION OF THE PROBLEM :
      I first observed the problem on NetBeans. The default text setting for the fonts (Tools - Options - Fonts & Colors - Default) was Monospaced 13pt. However on my system with this setting the source code was garbled and unreadable. I did some testing by changing the text size, only 12pt and 14 pt worked, and all other text size I tested resulted in garbled text. I have also tried to change the font type. I found only monospaced, NSimSun-18030, and SimSun-18030 had this garbled text problem, when the text size was not 12 or 14. From a thread on StackOverflow, I have also tried to turn off ClearType and it also worked.

      I then tracked down the problem to fontconfig.properties.src file under the JRE directory. It seemed to me that when the system locale was set to Simplified Chinese, Java would treat all characters as Chinese characters, and try to use SimSun-18030 Chinese font, and only 14pt and 12pt of this font works with ClearType smoothing on Windows system.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Set Windows system locale to Chinese (Simplified, PRC)
      2. Make sure the file SimSum18030.ttc exists under Windows\Fonts
      3. Run a Java program, which contains formatted text whose font is set to 13pt monospaced.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Readable text
      ACTUAL -
      Garbled text

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      There is no error message, just garbled texts.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Changing the text's size to 12pt or 14pt would work, or changing the font to a font other than NSimSun-18030 or SimSun-18030. Also, turning off ClearType seems to work, if the text font of the Java program could not be changed.

      Attachments

        Activity

          People

            mcherkas Mikhail Cherkasov (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: