FULL PRODUCT VERSION :
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Japanese environment.
A DESCRIPTION OF THE PROBLEM :
The issueJDK-8092947, text wrapping in Asian languages, has fixed.
However, there is a issue in Japanese yet.
For example, for a text (consists of Hiragana and white space) inputed to the TextArea, the behavor about wrapping is same wrong as beforeJDK-8092947.
I think the cause of this issue is detection method of CJK is wrong.
The chagneset forJDK-8092947 is follow:
http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/af7a2fabf339
According to the changeset, GlyphLayout.java is changed bellow.
+
+ if (Character.isIdeographic(codePoint)) {
+ flags |= FLAGS_HAS_CJK;
+ }
+
This change means the codePoint is CJK if the type of codePoint is ideograph.
But, Japanese Hiragana and Katakana are not contained in ideograph.
I don't know it's sufficient for the CJK detection that above plus Hiragana and Katakana.
At least, however, it is needed to add detection code to above for Hiragana and Katakana like following:
private static boolean isHiraOrKana(int codePoint) {
Character.UnicodeScript us = Character.UnicodeScript.of(codePoint);
return Character.UnicodeScript.HIRAGANA == us
|| Character.UnicodeScript.KATAKANA == us;
}
By the way, our customers sometimes request a behavior for Java FX like Swing.
So, we want to customize the wrapping behavior of the TextArea.
It's a enhancement request for Java FX.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Put a TextArea to your jfx application.
Set PrefColumnCount to 10 and WrapText to true.
Run the application and input Japanese Hiragana and space like follows:
(This sample text may get garbled if there is no Japanese environment.)
ああああ あああああ ああああああ
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The text is wrapped by only when the line reached the boundary of TextArea like follows:
(This sample text may get garbled if there is no Japanese environment.)
ああああ ああ
あああ ああああ
ああ
ACTUAL -
The text is wrapped same as english one.
(This sample text may get garbled if there is no Japanese environment.)
ああああ
あああああ
ああああああ
REPRODUCIBILITY :
This bug can be reproduced always.
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7601]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Japanese environment.
A DESCRIPTION OF THE PROBLEM :
The issue
However, there is a issue in Japanese yet.
For example, for a text (consists of Hiragana and white space) inputed to the TextArea, the behavor about wrapping is same wrong as before
I think the cause of this issue is detection method of CJK is wrong.
The chagneset for
http://hg.openjdk.java.net/openjfx/8u-dev/rt/rev/af7a2fabf339
According to the changeset, GlyphLayout.java is changed bellow.
+
+ if (Character.isIdeographic(codePoint)) {
+ flags |= FLAGS_HAS_CJK;
+ }
+
This change means the codePoint is CJK if the type of codePoint is ideograph.
But, Japanese Hiragana and Katakana are not contained in ideograph.
I don't know it's sufficient for the CJK detection that above plus Hiragana and Katakana.
At least, however, it is needed to add detection code to above for Hiragana and Katakana like following:
private static boolean isHiraOrKana(int codePoint) {
Character.UnicodeScript us = Character.UnicodeScript.of(codePoint);
return Character.UnicodeScript.HIRAGANA == us
|| Character.UnicodeScript.KATAKANA == us;
}
By the way, our customers sometimes request a behavior for Java FX like Swing.
So, we want to customize the wrapping behavior of the TextArea.
It's a enhancement request for Java FX.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Put a TextArea to your jfx application.
Set PrefColumnCount to 10 and WrapText to true.
Run the application and input Japanese Hiragana and space like follows:
(This sample text may get garbled if there is no Japanese environment.)
ああああ あああああ ああああああ
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The text is wrapped by only when the line reached the boundary of TextArea like follows:
(This sample text may get garbled if there is no Japanese environment.)
ああああ ああ
あああ ああああ
ああ
ACTUAL -
The text is wrapped same as english one.
(This sample text may get garbled if there is no Japanese environment.)
ああああ
あああああ
ああああああ
REPRODUCIBILITY :
This bug can be reproduced always.