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

Java2D ignores Meiryo font style in Japanese

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6
    • client-libs
    • 2d
    • x86
    • windows_vista

      FULL PRODUCT VERSION :
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b29)
      Java HotSpot(TM) Client VM (build 13.0-b02, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows Vista (ver6.0)

      A DESCRIPTION OF THE PROBLEM :
      With Meiryo, the new font of Windows Vista, Java2D ignores its style when in Japanese and the style is Italic.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the code.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Font;
      import java.awt.Graphics;
      import java.awt.Graphics2D;
      import java.util.Locale;

      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.SwingUtilities;


      @SuppressWarnings("serial")
      public class MeiryoBug extends JPanel {

      public static void main(String[] args) {

      SwingUtilities.invokeLater(
      new Runnable() {
      @Override
      public void run() {
      JFrame f = new JFrame();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.add(new MeiryoBug());
      f.setSize(600, 100);
      f.setVisible(true);
      }

      }
      );
      }

      @Override
      protected void paintComponent(Graphics g) {
      Graphics2D g2 = (Graphics2D) g.create();

      Font meiryoPlain = new Font("Meiryo", Font.PLAIN, 16);
      Font meiryoItalic = meiryoPlain.deriveFont(Font.ITALIC);
      Font meiryoBoldItalic = meiryoPlain.deriveFont(Font.BOLD | Font.ITALIC);

      g2.setFont(meiryoItalic);
      g2.drawString(
      meiryoItalic.getFontName(Locale.ENGLISH)
      + " "
      + meiryoItalic.getFontName(Locale.JAPANESE),
      0, 20
      );
      g2.setFont(meiryoBoldItalic);
      g2.drawString(
      meiryoBoldItalic.getFontName(Locale.ENGLISH)
      + " "
      + meiryoBoldItalic.getFontName(Locale.JAPANESE),
      0, 40
      );

      g2.dispose();
      }

      }

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

            prr Philip Race
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: