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

Font(Sazanami Mincho Font) rendering quality is not good on Swing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0u6
    • client-libs
    • 2d
    • sparc
    • linux

      OPERATING SYSTEM(S):
      Red Hat Enterprise Linux AS release 3 (Taroon Update 5)

      FULL JDK VERSION(S):
      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

      DESCRIPTION:
      When I use Java 5 with Sazanami Mincho font (it's one of free Japanese True Type font),
      some of large size Japanese characters are unreadable.

      This test requires Sazanami True Type fonts.
      You can download them from following URL:
        http://sourceforge.jp/projects/efont/files/
        http://prdownloads.sourceforge.jp/efont/10087/sazanami-20040629.tar.bz2

      Restore this file, put sazanami-gothic.ttf and sazanami-mincho.ttf into
      $HOME/.fonts directory.
      (If $HOME/.fonts is not available, create this directory)

      Type following command to check sazanami fonts are available or not:
        $ fc-list | grep -i sazanami
        Sazanami Gothic:style=Gothic-Regular
        Sazanami Mincho:style=Mincho-Regular

      Test instruction is as follows:

      1. Compile and run SazanamiFontTest
      2. Left-side is Sazanami Gothic, right-side is Sazanami Mincho.
         Over 21pt for Sazanami Mincho, some of characters are unreadable.

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

      class SazanamiFontTest extends JFrame {
        String test_string = "\u8868\u793a";
        SazanamiFontTest() {
          Container c = getContentPane();
          c.setLayout(new GridLayout(0,2));
          for(int i=12; i<=30; i++) {
            JLabel lbl_g = new JLabel(i+test_string);
            JLabel lbl_m = new JLabel(i+test_string);
            lbl_g.setFont(new Font("Sazanami Gothic", Font.PLAIN, i));
            lbl_m.setFont(new Font("Sazanami Mincho", Font.PLAIN, i));
            c.add(lbl_g);
            c.add(lbl_m);
          }
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          pack();
          setVisible(true);
        }
        public static void main(String[] args) {
          SazanamiFontTest f = new SazanamiFontTest();
        }
      }
      ====================================================================

      I checked Sazanami Mincho's font quality by using following scripts.

      ====================================================================
      #!/bin/sh
      SIZE=12
      while test "$SIZE" -le "30"
      do
        # HYOU (U+8868)
        xfd -fa "Sazanami Mincho:pixelsize=${SIZE}.0:antialias=false " -start 34920 -rows 1 -columns 1 -xrm "*title: ${SIZE}pt" &
        # JI (U+793A)
        #xfd -fa "Sazanami Mincho:pixelsize=${SIZE}.0:antialias=false " -start 31034 -rows 1 -columns 1 -xrm "*title: ${SIZE}pt" &
        SIZE=`expr $SIZE + 1`
      done
      ====================================================================

      xfd is using XFreeType library and all characters are readable.
      Please check font rendering quality.

            Unassigned Unassigned
            elarsen Erik Larsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: