negativeZero

Thursday Jan 18, 2007

java + Japanese fonts + Fedora 6

The other day I found out that my Japanese fonts are not displayed at all on Fedora 6 in java. How come ? The font paths in FC6 are different from FC4 and FC5. The japanese fonts are installed into

/usr/share/fonts/japanese/

instead of
/usr/share/fonts/ja/

Also, the names of the font files are different from what they used to be. I found a reference to similar problem on Katakai's blog for FC5. Unfortunately the post is in Japanese and since I do not know any Japanese, I just read what I could.

From what I understood one needs to adjust the property files to get the fonts displayed correctly. There are 2 ways how to fix the font displaying:

  • modify config of the JRE

in the directory <JRE>/lib, copy file 

fonts.RedHat.properties.src

 to 

fonts.RedHat.properties

Modify the locations of the true type fonts from:

filename.-misc-kochi_gothic-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/ja/TrueType/kochi-gothic-subst.ttf
filename.-misc-kochi_mincho-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/ja/TrueType/kochi-mincho-subst.ttf

to

filename.-misc-kochi_gothic-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/japanese/TrueType/sazanami-gothic.ttf
filename.-misc-kochi_mincho-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/japanese/TrueType/sazanami-mincho.ttf

This is going to work for the JRE in which directory you create the property file.

  • symlink the paths

The other workaround is to create symlinks  to the old 'wrong' paths. This is going to work for any JDK with the 'wrong' path. I use this fix because I have more than one JDK installed and I'm lazy to do any modifications when I upgrade or just install new JDK. First, become a root.

cd /usr/share/fonts 
ln -sf japanese/ ja
ln -sf korean/ 
cd ja/TrueType 
ln -sf sazanami-gothic.ttf kochi-gothic-subst.ttf
ln -sf sazanami-mincho.ttf kochi-mincho-subst.ttf

Note that we did not update any info for X font server, we just symlinked the paths to adhere to the contents of default property file.

That works for me for JDK 1.5.0_10 and JDK 1.6.0_01-ea1 in Fedora Core 6

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

Calendar

Feeds

Search

Links

Navigation

Referrers