I have downloaded TTF fonts, in my case for tamil. What should I do in order to view the font in my Java application?
Created May 4, 2012
John O'Conner When you say "view the font" I assume you mean "activate or use the font." If you are using JDK 1.2 or later, you have two options for using the font:
-
Use its name directly in the Font constructor, ie
Font myFont = new Font("Tamil Font Name", Font.PLAIN, 14); -
Edit your font.properties file and include the tamil font in one of Java's 5 composite/virtual font names:
- dialog
- dialoginput
- serif
- sansserif
- monospaced
After creating a Font object using either option #1 or #2, you can call setFont(myFont) on the GUI component that displays your text.
Unfortunately, Sun's JDK does not yet have extensive support for rendering Indic or related scripts. So even with the above instructions, you may not get good rendering support. Look for better support in version 1.4.