Java的中文字体

java中文支持(或乱码的解决):java程序是跨平台的,但需要解决中文支持问题。
方法很简单,就是在java安装目录下放进去一个中文字体即可。
cd /usr/lib/jvm/java-6-sun/jre/lib/fonts
  sudo mkdir fallback
  cd fallback
  sudo ln -s /usr/share/fonts/truetype/wqy/wqy-zenhei.ttf(把某个中文字体链接进 fallback 目录,我选了最新的文泉驿夸父字体)
  sudo mkfontdir
  sudo mkfontscale

 

 

对于Java 1.4,其配置有所不同,配置文件名是font.properties,现将其内容附于下:

# %W% %E%
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
#

# Component Font Mappings For RedhatLinux 8.0/zh_CN
#
serif.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
serif.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

serif.italic.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

serif.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

serif.bold.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

serif.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

serif.bolditalic.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

serif.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

sansserif.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

sansserif.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

sansserif.italic.0=-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

sansserif.bold.0=-b&h-luxi sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1
sansserif.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

sansserif.bolditalic.0=-b&h-luxi sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

monospaced.0=-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1
monospaced.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

monospaced.italic.0=-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1
monospaced.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

monospaced.bold.0=-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1
monospaced.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

monospaced.bolditalic.0=-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1
monospaced.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialog.0=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1

dialog.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialog.italic.0=-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1
dialog.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialog.bold.0=-b&h-luxi sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1
dialog.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialog.bolditalic.0=-b&h-luxi sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1
dialog.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialoginput.0=-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1
dialoginput.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialoginput.italic.0=-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1
dialoginput.italic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialoginput.bold.0=-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1
dialoginput.bold.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

dialoginput.bolditalic.0=-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1
dialoginput.bolditalic.1=-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

# Missing Glyph Character
#
default.char=274f

# Component Font Character Encodings
#
fontcharset.serif.0=sun.io.CharToByteISO8859_1
fontcharset.serif.1=sun.io.CharToByteUnicodeBigUnmarked

fontcharset.sansserif.0=sun.io.CharToByteISO8859_1
fontcharset.sansserif.1=sun.io.CharToByteUnicodeBigUnmarked

fontcharset.monospaced.0=sun.io.CharToByteISO8859_1
fontcharset.monospaced.1=sun.io.CharToByteUnicodeBigUnmarked

fontcharset.dialog.0=sun.io.CharToByteISO8859_1
fontcharset.dialog.1=sun.io.CharToByteUnicodeBigUnmarked

fontcharset.dialoginput.0=sun.io.CharToByteISO8859_1
fontcharset.dialoginput.1=sun.io.CharToByteUnicodeBigUnmarked

# Exclusion Ranges
#

# XFontSet Information
#
fontset.serif.plain=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.serif.italic=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.serif.bold=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.serif.bolditalic=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.sansserif.plain=\
-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.sansserif.italic=\
-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.sansserif.bold=\
-b&h-luxi sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.sansserif.bolditalic=\
-b&h-luxi sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.monospaced.plain=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.monospaced.italic=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.monospaced.bold=\
-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.monospaced.bolditalic=\
-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialog.italic=\
-b&h-luxi sans-medium-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialog.bold=\
-b&h-luxi sans-bold-r-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialog.bolditalic=\
-b&h-luxi sans-bold-i-normal--*-%d-*-*-p-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialog.plain=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialoginput.italic=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialoginput.bold=\
-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialoginput.bolditalic=\
-b&h-luxi mono-bold-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.dialoginput.plain=\
-b&h-luxi mono-medium-r-normal--*-%d-*-*-m-*-iso8859-1,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

fontset.default=\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1
,\
-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1

filename.-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso8859-1=/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc

filename.-misc-wenquanyi zen hei-medium-r-normal--0-0-0-0-p-0-iso10646-1=/usr/share/fonts/wqy-zenhei/wqy-zenhei.ttc

appendedfontpath=/usr/share/fonts/wqy-zenhei/

 

 

弄好后,将font.properties.*删除,再看看ConsolePanel里边的字是不是好了?

你可能感兴趣的:(java)