TOC PREV NEXT INDEX




Configuring Font Support


Most font manipulation is handled with the following system properties:

ice.pilots.html4.baseFontFamily
ice.pilots.html4.minFontSize
ice.pilots.html4.testallglyphs
ice.pilots.html4.traceFonts

For more information on these properties, see System Properties.

Depending on the JDK you are using, you may need to customize font handling to display fonts correctly. The following sections describe adding fonts in JDK 1.1, displaying special characters in Windows fonts, and displaying double-byte characters.

Adding Fonts in JDK 1.1

To add fonts on your system to the JVM in Java 1.1, do the following:

  1. Add these lines to font.properties, replacing these specific fonts with the ones you want to add:

    verdana.0=Verdana,ANSI_CHARSET
    comic.0=Comic Sans MS,ANSI_CHARSET
    myfont.0=Arial,ANSI_CHARSET

    Only the name on the left (such as verdana) is exposed as a case-insensitive font name in Java, so you can give it any name you want. However, the font name cannot contain spaces.

    Depending on your setup, you may need to use a different charset and add WingDings and Symbol fonts for your new font entries. For more information, see the font.properties file.

  2. Set the following system property:

    ice.pilots.html4.addonFonts="verdana, comic, myfont"

    This is required because the new fonts you add to font.properties are not listed in the Java font enumeration, Toolkit.getFontList( ). In accordance with Sun's implementation, this enumerator always returns only five standard Java fonts. The value of the property is a comma-separated list of additional font names, without quotes, present in the Java runtime.

  3. Set the following system property to map CSS font names to the new fonts:

    ice.pilots.html4.addonFontMapping="Comic Sans MS, comic, Arial, myfont"

    Set this property to ensure that the CSS font name is mapped to the new font. The value is a comma-separated list of pairs of the CSS font names and the added Java font names. Verdana does not need to be mapped in this example, because the font name is the same as that in the CSS.

In Java 2, your application can use all the fonts installed on the system without these adjustments.

Displaying Special Characters in Windows Fonts

Some pages that your application renders may contain characters such as trademark or copyright symbols and quotation marks.

Your application relies on Java for Unicode support, so if the font used by the Java runtime contains the special characters and the encoding is correct, the characters are displayed.

However, in some Windows fonts, special characters are mapped to values that are defined as control characters in Unicode. In JDK 1.1.8 and 1.3.1, the font.properties file has these values commented out by default. These characters are filtered out by the JVM and are not displayed.

To display the characters correctly, uncomment the exclusions in the font.properties file. The exclusions are usually found at the end of the file.

This is not required in J2SE JDK 1.4 and higher.

Displaying Double-Byte Characters

Your application can display Japanese, Korean, Chinese, and other double-byte character sets if the appropriate fonts are installed on your system and the JVM is configured to support them. You require JRE international edition for JDK 1.1.x.

To configure the JVM, localize the file font.properties in the Lib directory. Be sure to back up the files first, then overwrite the default font.properties file with font.properties.xx, where xx is the unique language extension.

For example, for Japanese fonts, rename font.properties.ja to font.properties.

If you are using JDK 1.1, JDK 1.2, or JDK 1.3 on Windows, change the font.properties in the jre directory.

For JDK 1.4, the JVM has been enhanced and these changes may not be necessary on Windows, although they are necessary on Linux. For details on these changes, see http://java.sun.com/j2se/1.4.1/changes.html#Shift-JIS and http://java.sun.com/j2se/1.4.1/docs/guide/intl/encoding.doc.html.

Setting the ice.pilots.html4.testallglyphs system property in JDK 1.3.1 or great ensures that the font being used can render all the glyphs in the text. Its default setting is true. This property has no effect in JDK 1.1.8.



Copyright 2005. ICEsoft Technologies, Inc.
http://www.icesoft.com

TOC PREV NEXT INDEX