浅谈Linux 下Java 1.5 汉字方块问题解决方法
首先
注意jdk1.5字体配置文件是fontconfig.properties 而以前的版本是font.properties
1.找到jdk1.5的安装目录下的fontconfig.Trubo.properties.src修改如下
修改后的内容如下:
#文件内容开始
# @(#)linux.fontconfig.Turbo.properties1.5 04/04/01
#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
#
# Version
version=1
# Component Font Mappings
allfonts.chinese-gbk=-misc-simsun-medium-r-normal--*-%d-*-*-c-*-gbk-0
allfonts.chinese-gb2312=-misc-simsun-medium-r-normal--*-%d-*-*-c-*-gb2312.1980-0
allfonts.chinese-iso10646=-misc-simsun-medium-r-normal--*-%d-*-*-c-*-iso10646-1
allfonts.chinese-big5=-misc-simsun-medium-r-normal--*-%d-*-*-c-*-big5-0
allfonts.lucida=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
serif.plain.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
serif.plain.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
serif.plain.latin-1=-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1
serif.bold.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
serif.bold.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
serif.bold.latin-1=-b&h-lucidabright-demibold-r-normal--*-%d-*-*-p-*-iso8859-1
serif.italic.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
serif.italic.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
serif.italic.latin-1=-b&h-lucidabright-medium-i-normal--*-%d-*-*-p-*-iso8859-1
serif.bolditalic.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
serif.bolditalic.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
serif.bolditalic.latin-1=-b&h-lucidabright-demibold-i-normal--*-%d-*-*-p-*-iso8859-1
sansserif.plain.japanese-x0201=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
sansserif.plain.japanese-x0208=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
sansserif.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bold.japanese-x0201=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
sansserif.bold.japanese-x0208=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
sansserif.bold.latin-1=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.italic.japanese-x0201=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
sansserif.italic.japanese-x0208=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
sansserif.italic.latin-1=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
sansserif.bolditalic.japanese-x0201=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
sansserif.bolditalic.japanese-x0208=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
sansserif.bolditalic.latin-1=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
monospaced.plain.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
monospaced.plain.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
monospaced.plain.latin-1=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bold.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
monospaced.bold.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
monospaced.bold.latin-1=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.italic.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
monospaced.italic.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
monospaced.italic.latin-1=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
monospaced.bolditalic.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
monospaced.bolditalic.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
monospaced.bolditalic.latin-1=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialog.plain.japanese-x0201=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
dialog.plain.japanese-x0208=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
dialog.plain.latin-1=-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bold.japanese-x0201=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
dialog.bold.japanese-x0208=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
dialog.bold.latin-1=-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.italic.japanese-x0201=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
dialog.italic.japanese-x0208=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
dialog.italic.latin-1=-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialog.bolditalic.japanese-x0201=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
dialog.bolditalic.japanese-x0208=-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
dialog.bolditalic.latin-1=-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1
dialoginput.plain.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
dialoginput.plain.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
dialoginput.plain.latin-1=-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bold.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
dialoginput.bold.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
dialoginput.bold.latin-1=-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.italic.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
dialoginput.italic.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
dialoginput.italic.latin-1=-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1
dialoginput.bolditalic.japanese-x0201=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0
dialoginput.bolditalic.japanese-x0208=-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0
dialoginput.bolditalic.latin-1=-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1
# Search Sequences
sequence.allfonts=chinese-gbk
sequence.allfonts=latin-1
sequence.allfonts.Big5=latin-1,chinese-big5
sequence.allfonts.Big5-HKSCS=latin-1,chinese-big5
sequence.allfonts.GB18030=latin-1,chinese-gbk,chinese-iso10646
sequence.allfonts.GBK=latin-1,chinese-gbk
sequence.allfonts.GB2312=latin-1,chinese-gb2312
sequence.allfonts.x-euc-jp-linux=latin-1,japanese-x0208,japanese-x0201
sequence.allfonts.UTF-8.ja.JP=latin-1,japanese-x0208,japanese-x0201,chinese-iso10646
sequence.allfonts.UTF-8.zh=latin-1,chinese-iso10646,japanese-x0208,japanese-x0201
sequence.fallback=lucida,chinese-big5,chinese-iso10646,japanese-x0208
# Exclusion Ranges
exclusion.japanese-x0201=0390-03d6,2200-22ef,2701-27be
exclusion.japanese-x0208=0390-03d6,2200-22ef,2701-27be
# Font File Names
filename.-b&h-lucidasans-medium-r-normal-sans-*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaSansRegular.ttf
filename.-b&h-lucidabright-medium-r-normal--*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaBrightRegular.ttf
filename.-b&h-lucidabright-demibold-r-normal--*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaBrightDemiBold.ttf
filename.-b&h-lucidabright-medium-i-normal--*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaBrightItalic.ttf
filename.-b&h-lucidabright-demibold-i-normal--*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaBrightDemiItalic.ttf
filename.-b&h-lucidasans-bold-r-normal-sans-*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaSansDemiBold.ttf
filename.-b&h-lucidasans-medium-i-normal-sans-*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaSansRegular.ttf
filename.-b&h-lucidasans-bold-i-normal-sans-*-%d-*-*-p-*-iso8859-1=$JRE_LIB_FONTS/LucidaSansDemiBold.ttf
filename.-b&h-lucidatypewriter-medium-r-normal-sans-*-%d-*-*-m-*-iso8859-1=$JRE_LIB_FONTS/LucidaTypewriterRegular.ttf
filename.-b&h-lucidatypewriter-bold-r-normal-sans-*-%d-*-*-m-*-iso8859-1=$JRE_LIB_FONTS/LucidaTypewriterBold.ttf
filename.-b&h-lucidatypewriter-medium-i-normal-sans-*-%d-*-*-m-*-iso8859-1=$JRE_LIB_FONTS/LucidaTypewriterRegular.ttf
filename.-b&h-lucidatypewriter-bold-i-normal-sans-*-%d-*-*-m-*-iso8859-1=$JRE_LIB_FONTS/LucidaTypewriterBold.ttf
filename.-misc-simsun-medium-r-normal--*-%d-*-*-c-*-big5-0=/usr/share/fonts/truetype/DIY/simsun.ttc
filename.-misc-simsun-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/truetype/DIY/simsun.ttc
filename.-misc-simsun-medium-r-normal--*-%d-*-*-c-*-gbk-0=/usr/share/fonts/truetype/DIY/simsun.ttc
filename.-misc-simsun-medium-r-normal--*-%d-*-*-c-*-gb2312.1980-0=/usr/share/fonts/truetype/DIY/simsun.ttc
filename.-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0=/usr/share/fonts/ja/TrueType/tlgothic.ttc
filename.-ricoh-gothic-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0=/usr/share/fonts/ja/TrueType/tlgothic.ttc
filename.-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0201.1976-0=/usr/share/fonts/ja/TrueType/tlmincho.ttc
filename.-ricoh-mincho-medium-r-normal--*-%d-*-*-c-*-jisx0208.1983-0=/usr/share/fonts/ja/TrueType/tlmincho.ttc
# AWT X11 font paths
awtfontpath.chinese-big5=/usr/share/fonts/truetype/DIY
awtfontpath.chinese-gb2312=/usr/share/fonts/truetype/DIY
awtfontpath.chinese-gbk=/usr/usr/share/fonts/truetype/DIY
awtfontpath.chinese-iso10646=/usr/share/fonts/truetype/DIY
#文件内容结束
1.关键的修改地方如下所述
a.把所有的-tls-zysong- 改为 -misc-simsun
b.把所有的关于simsun 字体的目录改为你的系统下的正确的目录,主要的地方是
#AWT X11 font paths 段
#Font File Names 段
2. 最后注意把修改后的fontconfig.Turbo.properties.src 名字修改为fontconfig.properties
我的Linux 系统是Debian修改后汉字效果如下图所示