NetBean6字体配置(转)

本文介绍了解决Java应用程序中字体显示问题的方法,通过调整NetBeans和squirrel-sql等工具的字体配置,实现了英文和中文字体的良好显示效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装netbean6.5多国语言版、squirrel-sql-2.4.1等开发工具、默认字体都是Monospace 12;但是编码时英文字体以宋体显示、显示极为难看,google上荡了N多方法,建议多是修改netbean、squirrel-sql-2.4.1字体为Courier New;
默认情况下,Java应用程序中的中文字体和英文字体是分开使用的,这样导致不能同时使用某个英文字体和某个中文字体来显示同个程序中包含中文和英文的文字。例如,在Netbeans中不能使用Courser 10 Pitch字体(Windows下为Courser New)和某个中文字体(比如宋体或微软雅黑)来显示一个java源代码,如果选择Courser字体,那么源代码中的中文就无法显示,如果选择宋体或雅黑,那么英文字体则是采用默认映射的某个字体。
忍耐了俩个多月,周末有系统研究了一边,发现网上说好多java目录中jre1.5.0_07\lib\fontconfig.properties.src解决,本人尝试N次,但一直无效,最后在阅读netbean启动加载配置时发现了这个一直导致无效的问题:
NetBeans 6.1\etc\netbeans.conf

#DefaultlocationofJDK,canbeoverriddenbyusing--jdkhome<dir>:
netbeans_jdkhome
="C:\Program Files\Java\jdk1.5.0_07"

netbean使用的并不是C:\Program Files\Java\jre1.5.0_07\lib,而是C:\Program Files\Java\jdk1.5.0_07\jre,我们找到了地方,然后修改加载顺序,对于英文,monospaced默认就是映射为Courier New字体,但为什么在Java程序里(比如Netbeans)确不能显示呢?将\fontconfig.properties.src内容复制到fontconfig.properties,然后找到sequence.monospaced.GBK=sequence.monospaced.GBK=chinese-ms936,alphabetic,dingbats,symbol,可以看出对于中文字体的搜索顺序是先搜chinese-ms936,而chinese-ms936是用allfonts的雅黑来显示英文,所以不好看,因此你只要简单将 chinese-ms936和alphabetic这两个交换一下变成:sequence.monospaced.GBK=alphabetic,chinese-ms936,dingbats,symbol保存后重新启动netbean,squirrel-sql-2.4.1等java桌面应用,ok,一切都搞定了;如果原来修改了netbean的字体设置,麻烦你恢复为默认配置,这样再次打开java开发的软件,ok,是不是漂亮了^_^

下面是我修改后的文件:
#@(#)fontconfig.properties1.504/01/28
#
#Copyright
2003SunMicrosystems,Inc.Allrightsreserved.
#

#Version

version
=1

#ComponentFontMappings

allfonts.chinese-ms936
=SimSun
allfonts.chinese-gb18030
=SimSun-18030
allfonts.chinese-hkscs
=MingLiU_HKSCS
allfonts.devanagari
=Mangal
allfonts.dingbats
=Wingdings
allfonts.lucida
=LucidaSansRegular
allfonts.symbol
=Symbol
allfonts.thai
=LucidaSansRegular

serif.plain.alphabetic
=TimesNewRoman
serif.plain.chinese-ms950
=MingLiU
serif.plain.hebrew
=David
serif.plain.japanese
=MSMincho
serif.plain.korean
=Batang

serif.bold.alphabetic
=TimesNewRomanBold
serif.bold.chinese-ms950
=PMingLiU
serif.bold.hebrew
=DavidBold
serif.bold.japanese
=MSMincho
serif.bold.korean
=Batang

serif.italic.alphabetic
=TimesNewRomanItalic
serif.italic.chinese-ms950
=PMingLiU
serif.italic.hebrew
=David
serif.italic.japanese
=MSMincho
serif.italic.korean
=Batang

serif.bolditalic.alphabetic
=TimesNewRomanBoldItalic
serif.bolditalic.chinese-ms950
=PMingLiU
serif.bolditalic.hebrew
=DavidBold
serif.bolditalic.japanese
=MSMincho
serif.bolditalic.korean
=Batang

sansserif.plain.alphabetic
=Arial
sansserif.plain.chinese-ms950
=MingLiU
sansserif.plain.hebrew
=David
sansserif.plain.japanese
=MSGothic
sansserif.plain.korean
=Gulim

sansserif.bold.alphabetic
=ArialBold
sansserif.bold.chinese-ms950
=PMingLiU
sansserif.bold.hebrew
=DavidBold
sansserif.bold.japanese
=MSGothic
sansserif.bold.korean
=Gulim

sansserif.italic.alphabetic
=ArialItalic
sansserif.italic.chinese-ms950
=PMingLiU
sansserif.italic.hebrew
=David
sansserif.italic.japanese
=MSGothic
sansserif.italic.korean
=Gulim

sansserif.bolditalic.alphabetic
=ArialBoldItalic
sansserif.bolditalic.chinese-ms950
=PMingLiU
sansserif.bolditalic.hebrew
=DavidBold
sansserif.bolditalic.japanese
=MSGothic
sansserif.bolditalic.korean
=Gulim

monospaced.plain.alphabetic
=CourierNew
monospaced.plain.chinese-ms950
=MingLiU
monospaced.plain.hebrew
=David
monospaced.plain.japanese
=MSGothic
monospaced.plain.korean
=GulimChe

monospaced.bold.alphabetic
=CourierNewBold
monospaced.bold.chinese-ms950
=PMingLiU
monospaced.bold.hebrew
=DavidBold
monospaced.bold.japanese
=MSGothic
monospaced.bold.korean
=GulimChe

monospaced.italic.alphabetic
=CourierNewItalic
monospaced.italic.chinese-ms950
=PMingLiU
monospaced.italic.hebrew
=David
monospaced.italic.japanese
=MSGothic
monospaced.italic.korean
=GulimChe

monospaced.bolditalic.alphabetic
=CourierNewBoldItalic
monospaced.bolditalic.chinese-ms950
=PMingLiU
monospaced.bolditalic.hebrew
=DavidBold
monospaced.bolditalic.japanese
=MSGothic
monospaced.bolditalic.korean
=GulimChe

dialog.plain.alphabetic
=Arial
dialog.plain.chinese-ms950
=MingLiU
dialog.plain.hebrew
=David
dialog.plain.japanese
=MSGothic
dialog.plain.korean
=Gulim

dialog.bold.alphabetic
=ArialBold
dialog.bold.chinese-ms950
=PMingLiU
dialog.bold.hebrew
=DavidBold
dialog.bold.japanese
=MSGothic
dialog.bold.korean
=Gulim

dialog.italic.alphabetic
=ArialItalic
dialog.italic.chinese-ms950
=PMingLiU
dialog.italic.hebrew
=David
dialog.italic.japanese
=MSGothic
dialog.italic.korean
=Gulim

dialog.bolditalic.alphabetic
=ArialBoldItalic
dialog.bolditalic.chinese-ms950
=PMingLiU
dialog.bolditalic.hebrew
=DavidBold
dialog.bolditalic.japanese
=MSGothic
dialog.bolditalic.korean
=Gulim

dialoginput.plain.alphabetic
=CourierNew
dialoginput.plain.chinese-ms950
=MingLiU
dialoginput.plain.hebrew
=David
dialoginput.plain.japanese
=MSGothic
dialoginput.plain.korean
=Gulim

dialoginput.bold.alphabetic
=CourierNewBold
dialoginput.bold.chinese-ms950
=PMingLiU
dialoginput.bold.hebrew
=DavidBold
dialoginput.bold.japanese
=MSGothic
dialoginput.bold.korean
=Gulim

dialoginput.italic.alphabetic
=CourierNewItalic
dialoginput.italic.chinese-ms950
=PMingLiU
dialoginput.italic.hebrew
=David
dialoginput.italic.japanese
=MSGothic
dialoginput.italic.korean
=Gulim

dialoginput.bolditalic.alphabetic
=CourierNewBoldItalic
dialoginput.bolditalic.chinese-ms950
=PMingLiU
dialoginput.bolditalic.hebrew
=DavidBold
dialoginput.bolditalic.japanese
=MSGothic
dialoginput.bolditalic.korean
=Gulim

#SearchSequences

sequence.allfonts
=alphabetic/default,dingbats,symbol

sequence.serif.GBK
=alphabetic,chinese-ms936,dingbats,symbol
sequence.sansserif.GBK
=alphabetic,chinese-ms936,dingbats,symbol
sequence.monospaced.GBK
=alphabetic,chinese-ms936,dingbats,symbol
sequence.dialog.GBK
=alphabetic,chinese-ms936,dingbats,symbol
sequence.dialoginput.GBK
=alphabetic,chinese-ms936,dingbats,symbol

sequence.serif.GB18030
=alphabetic,chinese-gb18030,dingbats,symbol
sequence.sansserif.GB18030
=alphabetic,chinese-gb18030,dingbats,symbol
sequence.monospaced.GB18030
=alphabetic,chinese-gb18030,dingbats,symbol
sequence.dialog.GB18030
=alphabetic,chinese-gb18030,dingbats,symbol
sequence.dialoginput.GB18030
=alphabetic,chinese-gb18030,dingbats,symbol

sequence.serif.x-windows-
950=alphabetic,chinese-ms950,dingbats,symbol
sequence.sansserif.x-windows-
950=alphabetic,chinese-ms950,dingbats,symbol
sequence.monospaced.x-windows-
950=chinese-ms950,alphabetic,dingbats,symbol
sequence.dialog.x-windows-
950=alphabetic,chinese-ms950,dingbats,symbol
sequence.dialoginput.x-windows-
950=alphabetic,chinese-ms950,dingbats,symbol

sequence.serif.x-MS950-HKSCS
=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol
sequence.sansserif.x-MS950-HKSCS
=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol
sequence.monospaced.x-MS950-HKSCS
=chinese-ms950,alphabetic,chinese-hkscs,dingbats,symbol
sequence.dialog.x-MS950-HKSCS
=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol
sequence.dialoginput.x-MS950-HKSCS
=alphabetic,chinese-ms950,chinese-hkscs,dingbats,symbol

sequence.allfonts.UTF-
8.hi=alphabetic/1252,devanagari,dingbats,symbol

sequence.allfonts.windows-
1255=hebrew,alphabetic/1252,dingbats,symbol

sequence.serif.windows-31j
=alphabetic,japanese,dingbats,symbol
sequence.sansserif.windows-31j
=alphabetic,japanese,dingbats,symbol
sequence.monospaced.windows-31j
=japanese,alphabetic,dingbats,symbol
sequence.dialog.windows-31j
=alphabetic,japanese,dingbats,symbol
sequence.dialoginput.windows-31j
=alphabetic,japanese,dingbats,symbol

sequence.serif.x-windows-
949=alphabetic,korean,dingbats,symbol
sequence.sansserif.x-windows-
949=alphabetic,korean,dingbats,symbol
sequence.monospaced.x-windows-
949=korean,alphabetic,dingbats,symbol
sequence.dialog.x-windows-
949=alphabetic,korean,dingbats,symbol
sequence.dialoginput.x-windows-
949=alphabetic,korean,dingbats,symbol

sequence.allfonts.x-windows-
874=alphabetic,thai,dingbats,symbol

sequence.fallback
=lucida,\
chinese-ms950
,chinese-hkscs,chinese-ms936,chinese-gb18030,\
japanese
,korean

#ExclusionRanges

exclusion.alphabetic
=0700-1e9f,1f00-20ab,20ad-f8ff
exclusion.chinese-gb18030
=0390-03d6,2200-22ef,2701-27be
exclusion.hebrew
=0041-005a,0060-007a,007f-00ff,20ac-20ac

#MonospacedtoProportionalwidthvariantmapping
#(Experimentalprivatesyntax)
proportional.MS_Gothic
=MSPGothic
proportional.MS_Mincho
=MSPMincho
proportional.MingLiU
=PMingLiU

#FontFileNames

filename.Arial
=ARIAL.TTF
filename.Arial_Bold
=ARIALBD.TTF
filename.Arial_Italic
=ARIALI.TTF
filename.Arial_Bold_Italic
=ARIALBI.TTF

filename.Courier_New
=COUR.TTF
filename.Courier_New_Bold
=COURBD.TTF
filename.Courier_New_Italic
=COURI.TTF
filename.Courier_New_Bold_Italic
=COURBI.TTF

filename.Times_New_Roman
=TIMES.TTF
filename.Times_New_Roman_Bold
=TIMESBD.TTF
filename.Times_New_Roman_Italic
=TIMESI.TTF
filename.Times_New_Roman_Bold_Italic
=TIMESBI.TTF

filename.SimSun
=SIMSUN.TTC
filename.SimSun-
18030=SIMSUN18030.TTC

filename.MingLiU
=MINGLIU.TTC
filename.PMingLiU
=MINGLIU.TTC
filename.MingLiU_HKSCS
=hkscsm3u.ttf

filename.David
=DAVID.TTF
filename.David_Bold
=DAVIDBD.TTF

filename.MS_Mincho
=MSMINCHO.TTC
filename.MS_PMincho
=MSMINCHO.TTC
filename.MS_Gothic
=MSGOTHIC.TTC
filename.MS_PGothic
=MSGOTHIC.TTC

filename.Gulim
=gulim.TTC
filename.Batang
=batang.TTC
filename.GulimChe
=gulim.TTC

filename.Lucida_Sans_Regular
=LucidaSansRegular.ttf
filename.Mangal
=MANGAL.TTF
filename.Symbol
=SYMBOL.TTF
filename.Wingdings
=WINGDING.TTF

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值