0

I created text editor using JTextArea. But it doesn't work for sinhala font type.

t = new JTextArea();
t.setFont(new Font("kaputadotcom2004", Font.PLAIN, 12));
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433

1 Answers1

3

Since kaputadotcom2004 isn´t a default font, you need to register your font to use it in your environment. You could do something like this (example taken from this answer):

try 
{
     GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
     ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("A.ttf")));
} 
catch (IOException|FontFormatException e) 
{
     //Handle exception
}
kAliert
  • 768
  • 9
  • 21