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

fontset properties should have other charset-registry names at least in zh_TW, k

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1.4
    • CPU:
      generic
    • OS:
      solaris_9
    • Verification:
      Not verified

      Description

      [5/21/97 smatu]
      Originally, the problem was reported in Asian E-reg testing.
      In Taiwan big5 locale (zh_TW.BIG5), users can see Chinese characters
      in the data-entry window, but cannot input Chinese into the text area.

      After probing the xlib function calls (by inserting a LD_PRELOAD
      module), I found the following function call---

      calling XCreateFontSet():
      -b&h-lucida sans-medium-r-normal-sans-*-120-*-*-p-*-iso8859-1,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-1,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-2,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-3,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-4,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-5,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-6,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-7,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-12,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-14,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-15,-sun-sung-medium-r-normal--*-120-*-*-c-*-cns11643-16

      It appears that AWT is calling XCreateFontSet() with a base font name
      taken from /usr/java/lib/font.properties.zh_TW
      (It is unfortunate that Java does not distinguish the encoding, i.e., BIG5
      part is not taken care of in searching the property files.)

      Now, in /usr/java/lib/font.properties.zh_TW, there are bunch of definitions
      for fontset: such as

      fontset.serif.plain=-linotype-times-medium-r-normal--*-%d-*-*-p-*-iso8859-1,-sun-sung-medium-r-normal--*-%d-*-*-c-*-cns11643-1,....
      ....


      The problem is that zh_TW.BIG5 and zh_TW use different fonts
      in terms of the charset-registry. In fact, zh_TW.BIG5 requires
      fonts of big5-0 and big5-1 as charset-registry names.
      AWT is forcing Motif to use a fontset which consists of cns11643
      charsets (as defined in font.properties.zh_TW), but the Xlib
      expects fontset to be composed of big5 charsets.

      Therefore, XCreateFontSet() is not completely successful, i.e.,
      missing_charset is returned. As a result, none of the Chinese
      characters can be drawn in the text area in AWT.

      This needs to be fixed.
      In Solaris, locale is <language name>_<territory name>.<encoding name>
      In case of Taiwan, we have two locales which have the same
      <language name>_<territory name> as zh_TW, but have different
      <encoding name>, (EUC and BIG5).
      Java cannot assume that these two use the same configuration
      for the fontset.

      ------------------------------------------------------------------------
      [chamness 5/29/97] Another user reports:

      From: Ko-Haw Nieh <###@###.###>
      Synopsis: NT4.0 -- cannot display multiByte characters (Big5) in TextArea

      Description:
      (1) unpack the following 4 files
      (2) copy font.properties to c:\jdk1.1.1\lib
      (3) install the MingLiU font on NT-4.0, it is on the NT4.0 CD
      (4) javac Bug1.java MyResources.java MyResources_zh_TW.java
      (5) java Bug1
           Big5 characters are displayed on button and canvas.
           No big5 characters is displayed in the TextArea.

      ::::::
      Bug1.java
      ::::::
      import java.awt.event.*;
      import java.awt.*;
      import java.awt.image.*;
      import java.util.*;
      import java.util.Locale;
      import java.util.ResourceBundle;
      import sun.io.*;

      class InputCanvas extends Canvas{
        public String big5Str = "";
        InputCanvas(){
          setSize(60,60);
          setBackground(Color.yellow);
        }
        public void paint(Graphics g){
           g.setColor(Color.yellow);
           g.fillRect(0, 0, 60,60);
           g.setColor(Color.black);
           g.setFont(new Font("Helvetica",Font.BOLD,20));
           g.drawString(big5Str,40,40);
        }
      }

      public class Bug1 extends Frame
      {
          String closeStr;
          public Bug1() {
          ResourceBundle myResources;

                  Panel p = new Panel();
      p.setLayout(new FlowLayout());

                  // Set the locale to current system locale
                  // and localize the buttons to display translations.

                  Locale myLocale = Locale.getDefault();
                  Locale twLocale = new Locale("zh","TW","");
                  myLocale.setDefault(twLocale);
                  myResources = ResourceBundle.getBundle("MyResources", myLocale);
      closeStr = myResources.getString("Close");
      p.add(new Button(closeStr));
      add("North",p);
                  InputCanvas inputCV = new InputCanvas();
                  inputCV.big5Str = closeStr;
                  add("Center",inputCV);
                  
                  inputCV.repaint();
              
                  TextArea tx = new TextArea(closeStr,8,40);
                  tx.setFont(new Font("Helvetica",Font.BOLD,20));
                  add("South",tx);

                  setSize(100,100);
          }
          // main program so it can be tested as a standalone program
           public static void main(String args[]) {
                Bug1 window = new Bug1();
                window.setTitle("TextArea is not localized");
                window.pack();
                window.show();
            }

      }

      :::::::
      MyResources.java
      :::::::
      package ListResourceBundle;

      import java.util.*;

      public class MyResources extends ListResourceBundle {
          public Object[][] getContents() {
      return contents;
          }

          static final Object[][] contents = {
      { "Close","Close" },
      { "Display String", "Display String" }
           };
      }
      ::::::::
      MyResources_zh_TW.java
      :::::::::

      package ListResourceBundle;

      import java.util.*;

      public class MyResources_zh_TW extends ListResourceBundle {
          public Object[][] getContents() {
      return contents;
          }

          static final Object[][] contents = {
      { "Close", "\u7d50\u675f" },
      { "Courier", "Courier" },
      { "Display String", "\u986f\u793a\u5b57\u7b26\u4e32" }
      };
      }
      ::::::::::
      font.properties
      ::::::::::::
      # @(#)font.properties.zh_TW 1.5 97/01/17
      #
      # AWT Font default Properties for Traditional Chinese Windows
      #

      # name aliases
      #
      alias.timesroman=serif
      alias.helvetica=sansserif
      alias.courier=monospaced

      dialog.0=Arial,ANSI_CHARSET
      dialog.1=MingLiU,CHINESEBIG5_CHARSET,NEED_CONVERTED
      dialog.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
      dialog.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

      dialoginput.0=Courier New,ANSI_CHARSET
      dialoginput.1=MingLiU,CHINESEBIG5_CHARSET,NEED_CONVERTED
      dialoginput.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
      dialoginput.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

      serif.0=Times New Roman,ANSI_CHARSET
      serif.1=MingLiU,CHINESEBIG5_CHARSET,NEED_CONVERTED
      serif.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
      serif.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

      sansserif.0=Arial,ANSI_CHARSET
      sansserif.1=MingLiU,CHINESEBIG5_CHARSET,NEED_CONVERTED
      sansserif.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
      sansserif.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

      monospaced.0=Courier New,ANSI_CHARSET
      monospaced.1=MingLiU,CHINESEBIG5_CHARSET,NEED_CONVERTED
      monospaced.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
      monospaced.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED

      # Static FontCharset info.
      #
      fontcharset.dialog.1=sun.io.CharToByteBig5
      fontcharset.dialog.2=sun.awt.windows.CharToByteWingDings
      fontcharset.dialog.3=sun.awt.CharToByteSymbol

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

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

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

      fontcharset.monospaced.1=sun.io.CharToByteBig5
      fontcharset.monospaced.2=sun.awt.windows.CharToByteWingDings
      fontcharset.monospaced.3=sun.awt.CharToByteSymbol

      # Exclusion Range info.
      #
      exclusion.dialog.0=0100-f8ff

      exclusion.dialoginput.0=0100-f8ff

      exclusion.serif.0=0100-f8ff

      exclusion.sansserif.0=0100-f8ff

      exclusion.monospaced.0=0100-f8ff

      # charset for text input
      #
      inputtextcharset=CHINESEBIG5_CHARSET

        Attachments

          Activity

            People

            Assignee:
            bcbeck Brian Beck (Inactive)
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: