HP-UX Java™ - Fonts and the Java™ Runtime Environment

» Back to the table of contents

This document gives you information on how HP-UX fonts are configured with your HP-UX Java™ runtime environment. Because the HP-UX SDK has built-in support for the Asian TrueType fonts, you will not normally need this information. However, if you want to change Java's font.properties files or if you have a font-related problem, this information is useful.

This document contains the following topics:
» X Windows, Java™ applications and TrueType fonts
» Installing Asian TrueType fonts (SDK 1.3x, 1.4x)
» The hp.fontpath property (SDK 1.3x, 1.4x only)
» Bitmap vs. Scalable fonts (all SDK versions)
» The JAVA_FONTS environment variable (SDK 1.3x, 1.4x only)
» How the X Font Server affects font display (all JDK versions)
» Controlling the X Font Server (all JDK versions)

A helpful document is Sun Microsystems' "Font Overview" at http://java.sun.com/j2se/1.4/docs/guide/intl/fontprop.html.

Another helpful article is "How Java™ products for HP-UX display Asian fonts".

X Windows, Java™ applications and TrueType fonts

This section gives you information on how HP-UX fonts are configured with your HP-UX Java™ runtime environment. Because the HP-UX SDK has built-in support for the Asian TrueType fonts, you will not normally need this information. However, if you want to change Java's font.properties files or if you have a font-related problem, this information is useful.

When your Java™ application runs under an Asian locale, the Java™ Logical Font Name may be mapped to an X Windows font using the font.properties files (which are locale-sensitive) in $JAVA_HOME/jre/lib. For Java™ 5.0, use the fontconfig.properties files.

When HP-UX Asian TrueType fonts are installed, they will be located at:

/usr/lib/X11/fonts/TrueType/japanese.st/typefaces
/usr/lib/X11/fonts/TrueType/korean.st/typefaces
/usr/lib/X11/fonts/TrueType/chinese_s.st/typefaces
/usr/lib/X11/fonts/TrueType/chinese_t.st/ktypefaces

Each set is shipped with the text files "fonts.dir" and "fonts.dir.jre". HP-UX's SDK reads the index file "fonts.dir.jre" if it exists, otherwise it reads "fonts.dir". The Font IDs (xlfd) used in your font.properties files MUST correspond to the IDs shipped in fonts.dir.jre.

Installing Asian TrueType fonts (SDK 1.3x, 1.4x)

The SDK now supports HP-UX Asian TrueType fonts, with the installation of the patches shown below. Follow these steps:

  1. Install the patches you need from the list below. Install the common patch, plus the appropriate patch for your language. To download patches, go to the Patch Database at the IT Resource Center at: http://us-support.external.hp.com/

    Select the link "Individual Patches" under Maintenance/Support. Scroll down to "retrieve a specific patch by entering the patch name" and enter the patch number in the input field. (This process will redirect you to a new patch if a patch has been superceded.) Read the information about the patch to ascertain any dependencies.

    Japanese: PHSS_26972 (for 11.0) or PHSS_26971 (for 11i)
    Korean:   PHSS_26974 (for 11.0) or PHSS_26973 (for 11i)
    Simple-Chinese:   PHSS_26976 (for 11.0) or PHSS_24975 (for 11i)
    Traditional Chinese:   PHSS_24937 (for 11.0) or PHSS_26977 (for 11i)
    Common:   PHSS_25091 (for 11.0) or PHSS_25092 (for 11i)

  2. Make sure you have installed HP's SDK version 1.3.1.02 or later, which supports Asian TrueType fonts, including new versions of the font.properties files. SDK 1.3.1.06 is recommended.

  3. When your Java™ application runs under an Asian locale, Java™ fonts are defined using the following fonts.properties files shipped in $JAVA_HOME/jre/lib.

    LANG Properties file Supported in SDK
    LANG=ja_JP.SJIS   font.properties.ja   1.3.1.02 1.4.0 1.4.1
    LANG=ja_JP.eucJP   font.properties.ja   1.3.1.02 1.4.0 1.4.1
    LANG=ko_KR.eucKR   font.properties.ko   1.3.1.02   1.4.0   1.4.1
    LANG=zh_CN.hp15N   font.properties.zh_EUC_CN   1.3.1.02   1.4.0   1.4.1
    LANG=zh_CN.GB18030   font.properties.zh_GB18030   1.3.1.06   1.4.0   1.4.1
    LANG=zh_TW.eucTW   font.properties.zh_TW_EUC_TW   1.3.1.07   1.4.0.01   1.4.1
    LANG=zh_TW.big5   font.properties.zh_TW_Big5   1.3.1.07   1.4.0.01   1.4.1
    LANG=zh_HK.hkbig5   font.properties.zh_HK_Big5_HKSCS   N/A   1.4.0.01   1.4.1

The hp.fontpath property (SDK 1.3x, 1.4x only)

When a font is installed to a location outside of JAVA_HOME, Java™ finds the font using the Java™ Fontpath. Java™ reads fonts.dir.jre (or fonts.dir) found along Java™ Fontpath to register scalable fonts.

Java™ Fontpath may be defined using the "hp.fontpath" property in your locale-sensitive font.properties file. The Java™ Fontpath is formed by combining the value of hp.fontpath with $JAVA_HOME/jre/lib/fonts. The default value of hp.fontpath is:

/usr/lib/X11/fonts/ms.st/typefaces:
/usr/lib/X11/fonts/type1.st/typefaces:
/usr/lib/X11/fonts/ttf.st/typefaces

Java™ Fontpath is NOT used to find bitmap fonts. Instead, bitmap fonts on HP-UX are found using the font path of the X Server (the X Fontpath).

Java™ heavyweight text components use fonts specified in the bottom section of the font.properties file.

Bitmap vs. Scalable fonts (all SDK versions)

Bitmap fonts are stored as such, but scalable fonts are stored as a description of the outline of the font. Scalable fonts are scaled by the X Server to any point size. TrueType is one format of a scalable font. (Type1 and F3 are two others.)

You can use the "xlsfonts" utility to test which X11 fonts are available on your machine.

The following is an example Font ID (xlfd) for 16- and 48-point sizes of the bitmap font "batang":

-hp-batang-medium-r-normal--16-160-75-75-c-160-ksc5601.1987-1
-hp-batang-medium-r-normal--48-160-75-75-c-160-ksc5601.1987-1

Scalable fonts can be recognized by the 0 values for the size fields in the xldf, as in this xlfd for "hybatang":

-hy-hybatang-medium-r-normal--0-0-0-0-m-0-ksc5601.1987-1

The JAVA_FONTS environment variable (SDK 1.3x, 1.4x only)

When the JAVA_FONTS environment variable is set, Java™ Fontpath is completely overridden. JAVA_FONTS is to be used for testing only. If JAVA_FONTS is not set, hp.fontpath (from font.properties) is used to construct Java™ Fontpath, as defined in this document.

How the X Font Server affects font display (all JDK versions)

The X Font Server (xfs) daemon affects what scalable TrueType fonts are available on your machine. (The xlsfonts utility lists both locally installed bitmap fonts and scalable fonts available via xfs.)

Java™ applications typically need xfs for good rendering using TrueType fonts.

Controlling the X Font Server (all JDK versions)

xfs is configured by default using /etc/X11/fs/config. Keep in mind that some HP-UX patches that install scalable fonts (for example, PHSS_25091 and PHSS_25092) may edit the xfs config file. This file includes a path used by xfs to find its fonts.

If you set RUN_X_FONT_SERVER in /etc/rc.config.d/xfs, xfs is started upon reboot and xfs is added to the font path. Alternatively you can use these two commands:

/usr/bin/X11/xfs -config /etc/X11/fs/config -port 7000 -daemon
xset +fp tcp/localhost:7000

Additionally, some HP previous SDK versions including 1.2.2.11 and 1.3.0.x, will start the font server when you execute a GUI application on a local display. See the section "Starting the X Font Server" section in the release notes for those versions at: HP-UX Java™ Information Library.