Linux系统中Java中文字体配置

(0 comments)

Windows系统中只要安装了中文字体就可以显示中文,Linux系统中默认的字体文件并不存在,所以无法正常显示中文。为了显示中文,我们需要做的是安装中文字体,在配置文件中设置正确的字体文件位置。

将新宋字体文件复制到/usr/share/fonts/windows位置,Java中字体配置如下所示:

JDK1.4.x版本

进入jre/lib目录,将font.properties.zh_CN.Redhat文件复制为font.properties,然后删除font.properties.zh_CN.*文件,编辑font.properties文件,设置正确的中文字体位置,如下:

filename.-misc-zysong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/windows/simsun.ttc

JDK1.5.x版本

进入jre/lib目录,将fontconfig.RedHat.properties.src文件复制为fontconfig.RedHat.properties,设置正确的中文字体位置,如下:

filename.-misc-zysong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/windows/simsun.ttc

当系统语言不是英文时,也可以以英文方式启动。

java -Duser.language=en
Current rating: 5

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required