Skip to main content

Software  > Globalization > 

Globalize your On Demand Business

Font

In Java application, we can use either logical font name or physical font name to create font for text display.

The logical font is a name associated with the physical font available on the system. The font.properties file provided by JVM is the mechanism to map the logical font name onto the physical font name installed on the operating system. A list of logical font name is as follow:

  • Dialog
  • SansSerif
  • Serif
  • Monospaced
  • DialogInput

Also, you can obtain a list of the logical font name by calling java.awt.Toolkit.getFontList () method. Usually, Java uses the font.properties file based on the current locale. When it is running on Thai operating system, the font.properties.th will be used. Below, shows some parts of font mappings in the font.properties.th file.

serif.0=Times New Roman
serif.1=Thonburi,THAI_CHARSET
serif.2=Lucida Sans Regular
serif.3=Times New Roman WT J
sansserif.0=Arial
sansserif.1=Thonburi,THAI_CHARSET
sansserif.2=Arial Unicode MS
sansserif.3=Lucida Sans Regular
monospaced.0=Courier New
monospaced.1=CourierThai,THAI_CHARSET
monospaced.2=Lucida Sans Typewriter Regular
monospaced.3=Lucida Sans Regular
monospaced.4=Monotype Sans Duospace WT J

Figure 3: font mapping in the font.properties.th file.

The main purpose of logical fonts used in java is portability between platforms. The disadvantage of logical font is that there are only five logical fonts recognized by Java. The java application can not take benefit from the wide variety of physical fonts provided by operating system.

Java 2 SDK allows application to directly specify physical font names available on system. To ensure that the physical font name does exist on the system before use, you can call the graphic.getAvailableFontFamilyNames () method to query the font names available on the system.

Java 2 SDK also provides the additional TrueType fonts in the jre\lib\fonts directory. See the font list below:

            Lucida Sans Regular
            Lucida Sans Typewriter
            CourierThai (this font is available in IBM Java 2 only).
            Thonburi (this font is available in IBM Java 2 only).

These fonts can be used by java application and java applet to display Thai text even if Thai fonts are not available on the operating system. However, Lucida font family is not recommended to display Thai text because some special font glyphs that used in character positioning support are missing. 


gray line

Continue to Text Rendering


E-mail us
Easy ways to get the answers you need.
E-mail us