A Unicode font is not rendered in SWING when the three characters ക (\ u0D15) + ് (\ u0D4D) + ര (\ u0D30) are combined, getting ര്ക instead of ക്ര

I am working on a text editor for Malayalam in Java.

Unicode font does not display correctly in Swing - JTextArea . Combination of characters. Instead of mixing two characters, the text area is displayed separately. Both swings and fonts support these characters, but it does not work in key combinations. Although a supported font is used. For instance:

What is necessary

 ക്രാ 

What gets

 ്രക 

code

 jButton69.setFont(new java.awt.Font("Meera", 0, 12)); // NOI18N jButton69.setText(" ്ര"); jTextArea1.append(jButton69.getText()); 

EDIT: (Additional info from author comments):

When combining the three characters ക (\ u0D15) + ് (\ u0D4D) + ര (\ u0D30), I get ര്ക instead of ക്ര.

Malayalam language, font - Meera

+6
source share
3 answers

You must install the JTextArea font as a Unicode font.

In addition, button 69 has nothing to do with the problem, so I do not use it.

The following code shows the text the way you want:

 String problemText = "ഔ"; Font font = new Font("Arial Unicode MS", Font.PLAIN, 18); JTextArea jTextArea1 = new JTextArea(); jTextArea1.setFont(font); jTextArea1.append(problemText); 

Hope this helps.

0
source

Please check out Zero Width Joiners and Zero Width Non-Joiners. For your requirement, I got the correct result using a stopper for zero width like: \ u0d15 + \ u0d4d + \ u200d + \ u0d30.

0
source

Please check out Zero Width Joiners and Zero Width Non-Joiners. For your requirement, I got the correct result using a zero width stop machine like: \ u0d15 + \ u0d4d + \ u200d + \ u0d30 (Please ignore my previous answer, this is the same, but sent with the wrong user account).

0
source

All Articles