I am trying to display Lao language text:
ຄິ້ງເຄັງສາຍພານ
in a JLabel in Java swing using sample code obtained from the following link.
The font picked is DokChampa. However, the text displayed is:

Note that the characters above the alphabets are displaced and moved to the right. However, the same text entered in Notepad or other editors in the system using the DokChampa font are displayed correctly.
When data entry is done in the JTextField using the Windows supported Lao keyboard also, the behavior is the same.
Other Fonts tried like LaoUI also have the same behavior in Java Swing components
Using JDK 1.8.0_152. My sample program is as below. Expected output is to see the text displayed as mentioned above.
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
public class TestLaos {
public static void main(String[] args) {
SwingUtilities.invokeLater( new Runnable() {
public void run() {
JLabel l = new JLabel();
String [] lstr = GraphicsEnvironment.getLocalGraphicsEnvironment ().getAvailableFontFamilyNames();
Font [] fList = new Font [lstr.length];
for (int i = 0; i <lstr.length; i ++)
{
fList [i] = new Font (lstr [i], Font.PLAIN, 20);
}
String rawString = new String("ຄິ້ງເຄັງສາຍພານ");
l.setText(rawString);
Font f = l.getFont ();
if (f.canDisplayUpTo (rawString)!=-1)
{//Find fonts that can not be displayed, then find available fonts
for (int i = 0; i <fList.length; i ++)
{
if (fList [i] .canDisplayUpTo (rawString) ==-1 && fList [i].getFontName().startsWith("DokChampa"))
{
System.out.println("Using font " + fList [i].getFontName() + " to display " + rawString);
l.setFont (fList [i]);
break;
}
}
}
JOptionPane.showMessageDialog(null, l);
}
});
}
}
