Loading Blog Search...

Sunday, March 04, 2007

JAVA Chinese fonts on Ubuntu

These days, I am trying to write a crossplatform tools (https://sourceforge.net/projects/bloghub) using JAVA, on a Kubuntu laptop. Although I expected that Linux JAVA chinese support could be much better than 5 years, when I use JAVA to do development, I am so disappointed that my JAVA system just show all Chinese characters as blank boxes.

Fortunately, the solution is quite simple:

  1. Search where is your system chinese fonts are, e.g., I use simhei&simsun from M$, at /usr/local/share/fonts.
  2. cd $JAVA_HOME/jre/lib/fonts
  3. ln -s /usr/local/share/fonts fallback
Is it simple? Sure we can adjust the fonts to display better, but that's enough for me. Good luck!

3 comments:

Anonymous said...

Thanks for your post, that helped me a lot to enable korean characters in Java. Some additional remarks for those who are about to follow this guideline: The font-directory to link must be the directory where the font-files actually are. It won't work if there are just other directories. Go into one of those directories in that case. On my Ubuntu 7.04 Feisty Fawn the fonts are located at /usr/share/fonts/truetype/. I've selected the Baekmuk-Fonts for Hangul, which are at /usr/share/fonts/truetype/baekmuk.
Good luck, and thanks for you post again!

Li-Zhao 李钊 said...

tkz for your input
:)

Unknown said...

Thanks - this helped me get Chinese characters displaying in Mandriva 2008.1. In case any Mandriva users come across this page, the directories I used to make it work were: '/usr/share/fonts/TTF/chinese' for the location of my Chinese fonts; and '/usr/lib/jvm/jre-sun/lib/fonts' for the location of the java font files. Thanks again for your help.