JDK-5105254 : Bold/Italic font styles are not enabled in Redhat AS3.0 in Japanese
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt:i18n
  • Affected Version: 1.4.2_04
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux
  • CPU: x86
  • Submitted: 2004-09-21
  • Updated: 2009-06-25
  • Resolved: 2009-02-06
Related Reports
Relates :  
Description

Name: wm7046			Date: 09/21/2004


[Description]
When running the below program with JRE 1.4.2_04-b05 on Redhat AS3.0 Update2, bold/Italic font-style are not enabled in Japanese.
So problems are the below.
     (1) Bold style is missing.
     (2) Italic style is missing.
     (3) Getting the following message:
     Warning: Cannot convert string
     "-watanabe-mincho-medium-r-normal--*-140-*-*-c-*-jisx0208.1983-0"
     to type FontStruct

[Step to Reproduce]
1. Compile source.
$ javac TestEastAsian.java
2. Run class file.
$ java TestEastAsian

[Source Code]
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.util.Locale;
public class TestEastAsian extends JFrame {
  public TestEastAsian() {
    super();
    try {
      testEastAsianInit();
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
  private void testEastAsianInit() throws Exception {
    this.setSize(new Dimension(540, 640));
    this.setTitle(System.getProperty("java.version")
        + " " + System.getProperty("os.name")
        + " " + System.getProperty("os.arch")
        + " " + System.getProperty("os.version")
        + " " + Locale.getDefault().toString()
        + " " + System.getProperty("file.encoding"));
    String fontName[] = {"dialog", "dialoginput",
               "serif", "sansserif", "monospaced"};
    int fontStyle[] = {Font.PLAIN, Font.BOLD,
               Font.ITALIC, Font.BOLD | Font.ITALIC};
    String fontStyleName[] = {"plain", "bold",
                  "italic", "bold + italic"};
    String language = Locale.getDefault().getLanguage();
    String country = Locale.getDefault().getCountry();
    String text;
    if (language.equals("ja")) {
      text = new String(
    "\u3088\u3046\u3053\u305d \u30d5\u30a1\u30a4\u30eb\u306e\u5834\u6240");
    } else if (language.equals("ko")) {
      text = new String(
        "\ud55c\uae00\uc774 \uc774\ub807\uac8c \ubcf4\uc5ec\uc694");
    } else if (language.equals("zh")) {
      if (country.equals("") || country.equals("CN")) {
        text = new String("\u6765\u6e90 \u53ef\u7528\u4ea7\u54c1");
      } else if (country.equals("TW")) {
        text = new String("\u4e2d\u6587\u5b57\u6e2c");
      } else {
        text = new String(
          "Please change OS locale to ja, ko, zh_CN, zh_TW");
      }
    } else {
        text = new String(
          "Please change OS locale to ja, ko, zh_CN, zh_TW");
    }
    int y = 0;
    JLabel jLabel;
    for (int n = 0; n < fontName.length; n++) {
      y += 30;
      jLabel = new JLabel();
      jLabel.setText("******** " + fontName[n] + " ********");
      jLabel.setBounds(72, y, 400, 20);
      this.getContentPane().add(jLabel);
      for (int s = 0; s < fontStyle.length; s++) {
        y += 20;
        jLabel = new JLabel();
        jLabel.setFont(new Font(fontName[n], fontStyle[s], 12));
        jLabel.setText(fontName[n] + " " + fontStyleName[s] + " : "
                 + text);
        jLabel.setBounds(72, y, 400, 20);
        this.getContentPane().add(jLabel);
      }
    }
    y += 30;
    jLabel = new JLabel();
    jLabel.setText(" ");
    jLabel.setBounds(72, y, 400, 20);
    this.getContentPane().add(jLabel);
  }
  public static void main(String[] args) {
    Frame frame = new TestEastAsian();
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = frame.getSize();
    if (frameSize.height > screenSize.height) {
      frameSize.height = screenSize.height;
    }
    if (frameSize.width > screenSize.width) {
      frameSize.width = screenSize.width;
    }
    frame.setLocation((screenSize.width - frameSize.width) / 2,
              (screenSize.height - frameSize.height) / 2);
    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) {
        System.exit(0);
      }
    });
    frame.setVisible(true);
  }
}

[Error Message]
Warning: Cannot convert string "-watanabe-mincho-medium-r-normal--*-140-*-*-c-*-jisx0208.1983-0" to type FontStruct
(Incident Review ID: 302258) 
======================================================================

Comments
WORK AROUND Copy the font.properties.ja.Redhat3 from 1.4.2_06 installation into 1.4.2_04. ###@###.### 2004-11-19 14:15:20 GMT
19-11-2004

EVALUATION Name: nl37777 Date: 09/21/2004 Red Hat AS 3.0 is not a supported configuration for JRE 1.4.2 - see http://java.sun.com/j2se/1.4.2/docs/guide/intl/locale.doc.html. Reclassifying as RFE. ====================================================================== After looking into the issue, it looks like a font configuration issue. JRE comes with a set of font.properties* files, which are placed under <jre>/lib folder. If the properties are modified or pointing to a font which is not installed in the correct folder this conversion problem would show up. The message shown on the screen is of WARNING type generated by X server, when request font is not available or not registered/added. There could be two possibilities - (1) when running the application on the same machine the font is not available or (2) when running from another machine [by setting DISPLAY=host:0.0], the target machine (X server) may not have proper subsitution when the X client requests one. The list of install fonts can be listed using the command 'xlsfonts'. ###@###.### 2004-11-19 12:57:38 GMT
19-11-2004