JDK-6184437 : Swing JFrame's window couldnot display title which containing Japanese fonts completely
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux_suse_sles_8.2,windows_2003
  • CPU: x86
  • Submitted: 2004-10-26
  • Updated: 2011-01-19
  • Resolved: 2005-06-22
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6Resolved
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
Disclaimer: Sorry I didnot find proper Category to put this bug in BugSter
           
           It is Swing + I18N problem on SUSE9.0 
           jdk1.4.2_01 and jdk 1.5.0_01

IHAC who encounters a problem.

His's JFrame couldnot display window title which containing Japanese fonts completely.

His OS is SUSE9.0 , It workds for redhat but fails for SUSE

Please find details in attachment
In attachment

1) WindowTitle.txt has OS , JAVA version, problem description
   Locale setup , required installed fonts packages and instruction for   
   reproducing problem

2) FontTest.java is testcase 

3) FontTest.FontTest.class is compiled class file

4) attached a file which is screenshot called partwindowtitle.jpg
   which could shows partial window title displaying problem

5) attached a file which is screenshot called fullwindowtitle.png
   which could show the complete windowtitle displaying 

###@###.### 10/26/04 09:47 GMT
###@###.### 10/26/04 13:57 GMT
###@###.### 10/27/04 16:35 GMT

Comments
EVALUATION See (a last) suggested fix. There's bug in XlibWrapper.c implementation of SetProperty wrapper. In a certain loop, we must calculate length in bytes, not characters. ###@###.### 2005-06-21 12:22:13 GMT Oops, buggy part was already fixed with 6269884. ###@###.### 2005-06-22 07:31:19 GMT
21-06-2005

SUGGESTED FIX (see update below) This bug supposedly can be fixed for most window managers and Linux distributions by the following patch. After the fix, I cannot reproduce this bug any more on my available machines. Note however, that I always set locale to a standard name from supported by X11 list of charsets, but not necessary UTF-8. ------- XlibWrapper.c ------- *** /tmp/sccs.3bZxsz 2005-02-15 17:18:24.511360586 +0300 --- XlibWrapper.c 2005-02-15 17:17:14.977590885 +0300 *************** *** 620,626 **** } #ifdef X_HAVE_UTF8_STRING status = Xutf8TextListToTextProperty((Display *)jlong_to_ptr(display), &cname, 1, ! XStdICCTextStyle, &tp); #else status = XmbTextListToTextProperty((Display *)jlong_to_ptr(display), &cname, 1, XStdICCTextStyle, &tp); --- 620,626 ---- } #ifdef X_HAVE_UTF8_STRING status = Xutf8TextListToTextProperty((Display *)jlong_to_ptr(display), &cname, 1, ! XUTF8StringStyle, &tp); #else status = XmbTextListToTextProperty((Display *)jlong_to_ptr(display), &cname, 1, XStdICCTextStyle, &tp); ###@###.### 2005-2-15 14:23:30 GMT UPDATE In fact, there was a bug in a loop after line 658. After this fix below, code should work locale-independent. ------- XlibWrapper.c ------- *** /tmp/sccs.Ox3Ewg 2005-06-21 16:15:38.844564588 +0400 --- XlibWrapper.c 2005-06-21 16:14:02.655604799 +0400 *************** *** 658,664 **** --- 658,668 ---- cname = ""; } + #ifdef X_HAVE_UTF8_STRING + length = (*env)->GetStringUTFLength(env, jstr); + #else length = (*env)->GetStringLength(env, jstr); + #endif list = malloc(length * sizeof(char*)); // Definitely not bigger than this list_ptr = list; *************** *** 677,683 **** #ifdef X_HAVE_UTF8_STRING status = Xutf8TextListToTextProperty((Display *)jlong_to_ptr(display), list, count, ! XStdICCTextStyle, &tp); #else status = XmbTextListToTextProperty((Display *)jlong_to_ptr(display), list, count, XStdICCTextStyle, &tp); --- 681,687 ---- #ifdef X_HAVE_UTF8_STRING status = Xutf8TextListToTextProperty((Display *)jlong_to_ptr(display), list, count, ! XUTF8StringStyle, &tp); #else status = XmbTextListToTextProperty((Display *)jlong_to_ptr(display), list, count, XStdICCTextStyle, &tp); ###@###.### 2005-06-21 12:22:13 GMT
15-02-2005

WORK AROUND Use a ja_JP.utf8 (or equivalent) locale. ###@###.### 2005-2-09 17:16:07 GMT
09-02-2005