TTFs, Japanese and RedHat7.x
Introduction
These are a few notes about how I eventually got Unicode-oriented
TrueType Fonts working in a Japanese environment in RedHat Linux 7.1
and 7.2.
The main reason I wanted to get the fonts working was to have them available
in Tcl/Tk 8.3+, however other applications such as Netscape and Mozilla
were also able to use them.
The fonts I wished to use were the Microsoft Arial (arialuni.ttf) which
is installed on the Windows partition of my system, and the Bitstream
Cyberbit font (cyberbit.ttf).
The Process
- the fonts need to be available in the
/usr/share/fonts/ja/TrueType/
directory. (This directory will have been created if you identify
at installation time that Japanese is a language you want to use.)
It is OK for them to be in another directory such as
/usr/share/fonts/default/TrueType/
provided that directory is listed in the
/etc/X11/fs/config
file.
In the case of arialuni.ttf I did this with a symbolic
link to the file in the Windows partition.
- having put the fonts in that place, you need to make/update the
fonts.scale
and
fonts.dir
files. You can do this is follows:
-
ttmkfdir > fonts.dir
- edit the resulting
fonts.dir
file to make sure the "jisx0208.1990-0" set of codes are available for
the arialuni and cyberbit fonts. You
can do this by duplicating one of the lines (e.g. koi8-ru) and editing
it to say "jisx0208.1990-0" at the end. If you are ever likely to use
JIS X 0212 as well, you may wish to add "jisx0212.1990-0" lines. Once
you have done that, you need to update the number in the first line of
the file to relect the number of font lines present.
(For some reason the
ttmkfdir
utility only seems to generate lines for ISO-8859-* and KOI8 character
sets.)
- copy the
fonts.dir
file over the
fonts.scale
file
- restart the font server. Rebooting is an easy way to do it.
The new Japanese fonts should now be available to a heap of X applications
which allow you to select fonts. Netscape 4.7x will see the Japanese
portions of the arialuni and cyberbit fonts, but will not try and use
them as Unicode fonts - you need Netscape 6, Mozilla, etc. for that.
In Tcl/Tk, you need to create a font, e.g.:
-
font create selfont -family "arial unicode ms" -size 24
and specify that in the Tk widget with
-font selfont.
The full set of fontnames available to Tcl/Tk can be seen by running
Tcl's
font families
command.
Here is a
sample
of a Tk widget (my Tcl/Tk Japanese vocab drill system) using the MSArial
font at 24 pts.
Jim Breen
April 2002
Jim Breen's Home Page and Japanese Page.