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

logical font and its system representation in ja locale look different

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
      2d
    • CPU:
      x86
    • OS:
      windows_nt

      Description



      Name: anR10225 Date: 06/27/2003


          When displaying japan text in 'ja' locale on Win2000 OS
      with Font 'dialog bold' there is a space left between glyphs.
      I.e.
        font.getStringBounds("" + ch1 + ch2).getWidth()
      is greater than
        font.getStringBounds("" + ch1).getWidth() +
        font.getStringBounds("" + ch2).getWidth()

          The 'dialog' font is mapped to MSGOTHIC.TTC font on Win platform, but
      when it is loaded explicitly from the file by Font.createFont() no
      space is left between glyphs. Thus the same physical font is displayed and
      measured differently depending on the way it is defined
      ('dialog' looks wider and higher on the screen)

          The similar problem also arises with all logical
      bold fonts in ja locale.

          The bug is reproducible on 1.5.0 and the latest builds. The test
      case should be compiled and run with options
      -Duser.language=ja -Duser.country=jp
          Below the test case and font.properties.ja files are listed:

      --------------- Test case --------------------
      import java.awt.*;
      import java.awt.geom.Rectangle2D;
      import java.awt.image.BufferedImage;
      import java.io.File;
      import java.io.FileInputStream;

      public class TestCase {
          static String testText ="\u3042\u3042\u3042\u3042\u3042\u3044\u3044\u3044\u3044\u3044\u3046\u3046\u3046\u3046\u3046\u3048\u3048\u3048\u3048\u3048\u304A\u304A\u304A\u304A\u304A";

          public static void main(String[] args) throws Exception {
              BufferedImage im = new BufferedImage(10,10, BufferedImage.TYPE_INT_RGB);
              Graphics2D g2d = (Graphics2D) im.getGraphics();

              Font dialog = new java.awt.Font("Dialog", Font.BOLD, 24);
              File f = new File("C:\\WINNT\\Fonts\\MSGOTHIC.TTC");
              Font font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(f)).
                      deriveFont(Font.BOLD, (float)24);

              FontMetrics fm1 = Toolkit.getDefaultToolkit().getFontMetrics(dialog);
              FontMetrics fm2 = Toolkit.getDefaultToolkit().getFontMetrics(font);

              Rectangle2D lm1 = dialog.getStringBounds(testText,g2d.getFontRenderContext());
              Rectangle2D lm2 = font.getStringBounds(testText,g2d.getFontRenderContext());

              System.out.println("(fm)dialog:" + fm1.stringWidth(testText));
              System.out.println("(fm)MSGothic:" + fm2.stringWidth(testText));

              System.out.println("(lm)dialog:" + lm1);
              System.out.println("(lm)MSGothic:" + lm2);
          }
      }

          
      ----------- lib/font.properties.ja -----------------


      # @(#)font.properties.ja 1.30 02/03/07
      #
      # Copyright 2002 Sun Microsystems, Inc. All rights reserved.
      #

      # Component Font Mappings
      #
      dialog.plain.0=Arial,ANSI_CHARSET
      dialog.plain.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      dialog.plain.2=WingDings,SYMBOL_CHARSET
      dialog.plain.3=Symbol,SYMBOL_CHARSET

      dialog.bold.0=Arial Bold,ANSI_CHARSET
      dialog.bold.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      dialog.bold.2=WingDings,SYMBOL_CHARSET
      dialog.bold.3=Symbol,SYMBOL_CHARSET

      dialog.italic.0=Arial Italic,ANSI_CHARSET
      dialog.italic.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      dialog.italic.2=WingDings,SYMBOL_CHARSET
      dialog.italic.3=Symbol,SYMBOL_CHARSET

      dialog.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
      dialog.bolditalic.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      dialog.bolditalic.2=WingDings,SYMBOL_CHARSET
      dialog.bolditalic.3=Symbol,SYMBOL_CHARSET

      dialoginput.plain.0=Courier New,ANSI_CHARSET
      dialoginput.plain.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      dialoginput.plain.2=WingDings,SYMBOL_CHARSET
      dialoginput.plain.3=Symbol,SYMBOL_CHARSET

      dialoginput.bold.0=Courier New Bold,ANSI_CHARSET
      dialoginput.bold.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      dialoginput.bold.2=WingDings,SYMBOL_CHARSET
      dialoginput.bold.3=Symbol,SYMBOL_CHARSET

      dialoginput.italic.0=Courier New Italic,ANSI_CHARSET
      dialoginput.italic.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      dialoginput.italic.2=WingDings,SYMBOL_CHARSET
      dialoginput.italic.3=Symbol,SYMBOL_CHARSET

      dialoginput.bolditalic.0=Courier New Bold Italic,ANSI_CHARSET
      dialoginput.bolditalic.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      dialoginput.bolditalic.2=WingDings,SYMBOL_CHARSET
      dialoginput.bolditalic.3=Symbol,SYMBOL_CHARSET

      serif.plain.0=Times New Roman,ANSI_CHARSET
      serif.plain.1=\uff2d\uff33 \u660e\u671d,SHIFTJIS_CHARSET
      serif.plain.2=WingDings,SYMBOL_CHARSET
      serif.plain.3=Symbol,SYMBOL_CHARSET

      serif.bold.0=Times New Roman Bold,ANSI_CHARSET
      serif.bold.1=\uff2d\uff33 \u660e\u671d,SHIFTJIS_CHARSET
      serif.bold.2=WingDings,SYMBOL_CHARSET
      serif.bold.3=Symbol,SYMBOL_CHARSET

      serif.italic.0=Times New Roman Italic,ANSI_CHARSET
      serif.italic.1=\uff2d\uff33 \u660e\u671d,SHIFTJIS_CHARSET
      serif.italic.2=WingDings,SYMBOL_CHARSET
      serif.italic.3=Symbol,SYMBOL_CHARSET

      serif.bolditalic.0=Times New Roman Bold Italic,ANSI_CHARSET
      serif.bolditalic.1=\uff2d\uff33 \u660e\u671d,SHIFTJIS_CHARSET
      serif.bolditalic.2=WingDings,SYMBOL_CHARSET
      serif.bolditalic.3=Symbol,SYMBOL_CHARSET

      sansserif.plain.0=Arial,ANSI_CHARSET
      sansserif.plain.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      sansserif.plain.2=WingDings,SYMBOL_CHARSET
      sansserif.plain.3=Symbol,SYMBOL_CHARSET

      sansserif.bold.0=Arial Bold,ANSI_CHARSET
      sansserif.bold.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      sansserif.bold.2=WingDings,SYMBOL_CHARSET
      sansserif.bold.3=Symbol,SYMBOL_CHARSET

      sansserif.italic.0=Arial Italic,ANSI_CHARSET
      sansserif.italic.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      sansserif.italic.2=WingDings,SYMBOL_CHARSET
      sansserif.italic.3=Symbol,SYMBOL_CHARSET

      sansserif.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
      sansserif.bolditalic.1=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      sansserif.bolditalic.2=WingDings,SYMBOL_CHARSET
      sansserif.bolditalic.3=Symbol,SYMBOL_CHARSET

      monospaced.plain.0=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      monospaced.plain.1=Courier New,ANSI_CHARSET
      monospaced.plain.2=WingDings,SYMBOL_CHARSET
      monospaced.plain.3=Symbol,SYMBOL_CHARSET

      monospaced.bold.0=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      monospaced.bold.1=Courier New Bold,ANSI_CHARSET
      monospaced.bold.2=WingDings,SYMBOL_CHARSET
      monospaced.bold.3=Symbol,SYMBOL_CHARSET

      monospaced.italic.0=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      monospaced.italic.1=Courier New Italic,ANSI_CHARSET
      monospaced.italic.2=WingDings,SYMBOL_CHARSET
      monospaced.italic.3=Symbol,SYMBOL_CHARSET

      monospaced.bolditalic.0=\uff2d\uff33 \u30b4\u30b7\u30c3\u30af,SHIFTJIS_CHARSET
      monospaced.bolditalic.1=Courier New Bold Italic,ANSI_CHARSET
      monospaced.bolditalic.2=WingDings,SYMBOL_CHARSET
      monospaced.bolditalic.3=Symbol,SYMBOL_CHARSET

      # Font File Names
      #
      filename.\uff2d\uff33_\u660e\u671d=MSMINCHO.TTC
      filename.\uff2d\uff33_\u30b4\u30b7\u30c3\u30af=MSGOTHIC.TTC

      filename.Arial=ARIAL.TTF
      filename.Arial_Bold=ARIALBD.TTF
      filename.Arial_Italic=ARIALI.TTF
      filename.Arial_Bold_Italic=ARIALBI.TTF

      filename.Courier_New=COUR.TTF
      filename.Courier_New_Bold=COURBD.TTF
      filename.Courier_New_Italic=COURI.TTF
      filename.Courier_New_Bold_Italic=COURBI.TTF

      filename.Times_New_Roman=TIMES.TTF
      filename.Times_New_Roman_Bold=TIMESBD.TTF
      filename.Times_New_Roman_Italic=TIMESI.TTF
      filename.Times_New_Roman_Bold_Italic=TIMESBI.TTF

      filename.WingDings=WINGDING.TTF
      filename.Symbol=SYMBOL.TTF

      # Missing Glyph Character
      #
      default.char=2751

      # Component Font Character Encodings
      #
      fontcharset.dialog.1=sun.io.CharToByteMS932
      fontcharset.dialog.2=sun.awt.windows.CharToByteWingDings
      fontcharset.dialog.3=sun.awt.CharToByteSymbol

      fontcharset.dialoginput.1=sun.io.CharToByteMS932
      fontcharset.dialoginput.2=sun.awt.windows.CharToByteWingDings
      fontcharset.dialoginput.3=sun.awt.CharToByteSymbol

      fontcharset.serif.1=sun.io.CharToByteMS932
      fontcharset.serif.2=sun.awt.windows.CharToByteWingDings
      fontcharset.serif.3=sun.awt.CharToByteSymbol

      fontcharset.sansserif.1=sun.io.CharToByteMS932
      fontcharset.sansserif.2=sun.awt.windows.CharToByteWingDings
      fontcharset.sansserif.3=sun.awt.CharToByteSymbol

      fontcharset.monospaced.0=sun.io.CharToByteMS932
      fontcharset.monospaced.1=sun.io.CharToByteISO8859_1
      fontcharset.monospaced.2=sun.awt.windows.CharToByteWingDings
      fontcharset.monospaced.3=sun.awt.CharToByteSymbol

      # Exclusion Ranges
      #
      exclusion.dialog.0=0100-20ab,20ad-ffff
      exclusion.dialoginput.0=0100-20ab,20ad-ffff
      exclusion.serif.0=0100-20ab,20ad-ffff
      exclusion.sansserif.0=0100-20ab,20ad-ffff
      exclusion.monospaced.1=0100-20ab,20ad-ffff

      # Text Input Character Set
      #
      inputtextcharset=SHIFTJIS_CHARSET
      ----------------------------------------------

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dougfelt Doug Felt
              Reporter:
              naasunw Naa Naa (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: