More on Java and Japanese fonts

The JGloss User's Guide already has some information on using Japanese fonts with Java. This document provides further tips.

Detailed information on the font.properties files

The Java runtime uses the font.properties files for font configuration. If you need more information on the format of the files, the Java Development Kit documentation has a detailed explanation. There is also an overview of how the font mechanism of Java works.

Windows users

A useable font should be detected by JGloss the first time it is started. If you configure Java to use the fonts from the "preferences.properties.ja" file, you have to assure that the requested fonts are installed. Sun's Java Runtime Environment assumes that the fonts MS Gothic (msgothic.ttf) and MS Mincho (msmincho.ttf) are installed. If you follow the instructions in the user guide, and still only see empty boxes where Japanese characters should be displayed, check the fonts folder if both fonts are available.

X11 users: Using Microsoft's Japanese TrueType fonts with X11

If you run an X server which can use TrueType fonts, you can install the Japanese fonts which come with the Windows Japanese support. The directions here are written for XFree 4 installed on Red Hat Linux, and assumes that a TrueType font directory is already configured.

  1. Copy the files msgothic.ttf and msmincho.ttf to the TrueType font directory used by the X server.
  2. Add the following lines to the fonts.scale file in the font directory:
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-c-0-iso10646-1
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-c-0-jisx0201.1976-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-c-0-jisx0208.1983-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-c-0-jisx0212.1990-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-c-0-iso8859-1
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-c-0-ascii-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-p-0-iso10646-1
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-p-0-jisx0201.1976-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-p-0-jisx0208.1983-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-p-0-jisx0212.1990-0
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-p-0-iso8859-1
    msgothic.ttf -Ricoh-MS Gothic-medium-r-normal--0-0-0-0-p-0-ascii-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-c-0-iso10646-1
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-c-0-jisx0201.1976-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1983-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-c-0-jisx0208.1990-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-c-0-jisx0212.1990-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-c-0-iso8859-1
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-c-0-ascii-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-p-0-iso10646-1
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-p-0-jisx0201.1976-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1983-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-p-0-jisx0208.1990-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-p-0-jisx0212.1990-0
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-p-0-iso8859-1
    msmincho.ttf -Ricoh-MS Mincho-medium-r-normal--0-0-0-0-p-0-ascii-0
    
    Also increase the number in the first line of the file (number of entries) by 28.
  3. Update the font information by running mkfontdir -e /usr/X11R6/lib/X11/fonts/encodings -e /usr/X11R6/lib/X11/fonts/encodings/large in the font directory.
  4. Tell the X font server to reload the font list (killall -HUP xfs). The fonts should now be available to X11 applications. You can test this by running xlsfonts | grep -i -e ricoh, which should display the list of just installed fonts.
  5. To use the fonts as default fonts in Java, you have to edit the font.properties.ja file in the lib directory of the Java Runtime Environment. In the original font.properties.ja, replace every occurrence of -wadalab-mincho- with -ricoh-ms mincho- and -wadalab-gothic- with -ricoh-ms gothic-.

Back to JGloss

(C) 2001-2003 Michael Koch <tensberg@gmx.net>; last change: 2003/02/21