2 回答
I got the problem.
As correctly pointed out by @bobince also, the issue was with the font Arial
which I was using.
To render a text of a particular language, the font should have glyphs for that language to correctly render the text.
e.g For rendering hindi text, fonts like Mangal
, which have glyphs for hindi language, will render the text correctly.
The same hindi font will work for Marathi language also since the glyphs remains same for both languages but won't work for languages like Tamil, Telugu etc.
You can try using different font such as MONOSPACED or SansSerif
Font font = new Font(Font.MONOSPACED, Font.PLAIN, 11);
graphics.setFont(font);
graphics.drawString("ट्रेल्स. रीकदोसै. जोकालन्त", 1, 10);
graphics.dispose();
where the I have used java.awt.Font class. This worked and the characters were represented correctly.