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

TrueType Fonts that use a CJK CMAP encoding are broken by 8008386.

XMLWordPrintable

    • 2d
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.8.0_92"
      Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]
      (Windows 7 Enterprise Service Pack 1)

      A DESCRIPTION OF THE PROBLEM :
      Some True Type fonts (YGO13D.ttf and YMjO24ks.ttf) that worked in Java 6 no longer work in Java 8.

      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.6.0_45"
      Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
      Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Install the YGO13D.ttf and YMjO24ks.ttf fonts.
      2) Compile the testFont.java program using JDK 1.6
      3) Run testFont and get expected results.
      4)Compile the testFont.java program using JDK 1.8
      4)Run testFont and the fonts do not display. Also the call to "font.canDisplayUpTo(name)" fails.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Console window output:

      Serif Plain
      Serif Italic
      Serif Bold
      Serif Bold & Italic
      YGO13D Plain
      YGO13D Italic
      YGO13D Bold
      YGO13D Bold & Italic
      YMjO24ks Plain
      YMjO24ks Italic
      YMjO24ks Bold
      YMjO24ks Bold & Italic

      ACTUAL -
      Output:

      Serif Plain
      Serif Italic
      Serif Bold
      Serif Bold & Italic
      <unsupported character boxes>
      <unsupported character boxes>
      <unsupported character boxes>
      <unsupported character boxes>
      <unsupported character boxes>
      <unsupported character boxes>
      <unsupported character boxes>
      <unsupported character boxes>

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      E:\Java\FontTest>echo Java home: c:/Applications/Java/jdk1.8.0_92
      Java home: c:/Applications/Java/jdk1.8.0_92

      E:\Java\FontTest>javac testFont.java

      E:\Java\FontTest>java testFont
      There is at least one character in text 'YGO13D Plain' that is not contained in
      font YGO13D: Y
      There is at least one character in text 'YGO13D Italic' that is not contained in
       font YGO13D: Y
      There is at least one character in text 'YGO13D Bold' that is not contained in f
      ont YGO13D: Y
      There is at least one character in text 'YGO13D Bold & Italic' that is not conta
      ined in font YGO13D: Y
      There is at least one character in text 'YMjO24ks Plain' that is not contained i
      n font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Italic' that is not contained
      in font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Bold' that is not contained in
       font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Bold & Italic' that is not con
      tained in font YMjO24ks: Y
      There is at least one character in text 'YGO13D Plain' that is not contained in
      font YGO13D: Y
      There is at least one character in text 'YGO13D Italic' that is not contained in
       font YGO13D: Y
      There is at least one character in text 'YGO13D Bold' that is not contained in f
      ont YGO13D: Y
      There is at least one character in text 'YGO13D Bold & Italic' that is not conta
      ined in font YGO13D: Y
      There is at least one character in text 'YMjO24ks Plain' that is not contained i
      n font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Italic' that is not contained
      in font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Bold' that is not contained in
       font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Bold & Italic' that is not con
      tained in font YMjO24ks: Y
      There is at least one character in text 'YGO13D Plain' that is not contained in
      font YGO13D: Y
      There is at least one character in text 'YGO13D Italic' that is not contained in
       font YGO13D: Y
      There is at least one character in text 'YGO13D Bold' that is not contained in f
      ont YGO13D: Y
      There is at least one character in text 'YGO13D Bold & Italic' that is not conta
      ined in font YGO13D: Y
      There is at least one character in text 'YMjO24ks Plain' that is not contained i
      n font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Italic' that is not contained
      in font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Bold' that is not contained in
       font YMjO24ks: Y
      There is at least one character in text 'YMjO24ks Bold & Italic' that is not con
      tained in font YMjO24ks: Y

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      File: testFont.java

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

      public class testFont extends JPanel {
            //String[] type = { "Serif","SansSerif"};
            //String[] type = { "Serif","Kredit","Yu Gothic","YGO13D","YMjO24ks"};
            String[] type = { "Serif","YGO13D","YMjO24ks"};
            int[] styles = { Font.PLAIN, Font.ITALIC, Font.BOLD,
            Font.ITALIC + Font.BOLD };
            String[] stylenames =
            { "Plain", "Italic", "Bold", "Bold & Italic" };

            public void paint(Graphics g) {
               for (int f = 0; f < type.length; f++) {
                  for (int s = 0; s < styles.length; s++) {
                     Font font = new Font(type[f], styles[s], 18);
                     g.setFont(font);
                     String name = type[f] + " " + stylenames[s];

                     int indexUnsupportedCharacter = font.canDisplayUpTo(name);
                     if (indexUnsupportedCharacter != -1)
                     {
                         System.out.println("There is at least one character in text '" + name + "' that is not contained in font " +

                          font.getFontName() + ": "+ name.substring(indexUnsupportedCharacter, indexUnsupportedCharacter+1));

                     }
                     
                     g.drawString(name, 20, (f * 4 + s + 1) * 20);
                  }
               }
            }

            public static void main(String[] a) {
               JFrame f = new JFrame();
               f.addWindowListener(new WindowAdapter() {
                  public void windowClosing(WindowEvent e) {
                     System.exit(0);
                  }
               }
            );

            f.setContentPane(new testFont());
            f.setSize(400,400);
            f.setVisible(true);
         }
      }


      -------------------------------------------
      *Command File to compile using JDK 1.6 45:
      set JAVA_HOME=c:/Applications/Java/jdk1.6.0_45
      set PATH=c:\Applications\Java\jdk1.6.0_45\bin;%PATH%
      set INCLUDE=c:\Applications\Java\jdk1.6.0_45\include;%INCLUDE%;
      echo Java home: %JAVA_HOME%
      javac testFont.java

      --------------------------------------------
      *Command file to compile using JDK 1.8 92
      set JAVA_HOME=c:/Applications/Java/jdk1.8.0_92
      set PATH=c:\Applications\Java\jdk1.8.0_92\bin;%PATH%
      set INCLUDE=c:\Applications\Java\jdk1.8.0_92\include;%INCLUDE%;
      echo Java home: %JAVA_HOME%
      javac testFont.java



      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The only workaround is reverting from JDK 1.8 to JDK 1.6.

      SUPPORT :
      YES

        1. 6u45.png
          76 kB
          Abhijit Roy
        2. 6u45+submitter's-font.png
          84 kB
          Abhijit Roy
        3. 7u79+submitter's-font.png
          94 kB
          Abhijit Roy
        4. 8u0.png
          74 kB
          Abhijit Roy
        5. 8u92.png
          76 kB
          Abhijit Roy
        6. 8u92+submitter's-font.png
          119 kB
          Abhijit Roy
        7. 9ea+124.png
          75 kB
          Abhijit Roy
        8. 9ea124+submitter's-font.png
          122 kB
          Abhijit Roy
        9. testFont.java
          2 kB
          Abhijit Roy
        10. YGO130D.ttf
          609 kB
          Abhijit Roy
        11. ymj240.ttf
          1.05 MB
          Abhijit Roy

            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: