JBuilder中出现的光标问题不是Borland的问题,而应该是Sun留下的麻烦。大家知道,i18n问题主要通过操作系统对用户工作地区和使用语言通过LOCALE
(Window2000或XP中的控制面板上通过“区域和语言选项”)来进行区分,从而开发者通过使用相应区域和语言的属性文件来实现软件包对国际化的支持。具体来说,JBuilder通过使用JRE的font.properties.zh来实现对中文字体的支持。
问题就出在SUN提供的font.properties.zh上。SUN在该文件中对各种字体的正常体,粗体,斜体均使用的是正常体。我们知道,在编辑器中,正常体和粗体或斜体占用的宽度是不同的。因此粗体(Bold)和正常体(plain)均使用正常体会导致编辑器对粗体字符宽度计算错误,这下,我们明白了问题的原因所在。有趣的是SUN对英文的字体属性文件却进行了正确的区别。(好像是故意的啊?!)比较font.properties和font.properties.zh文件,你可以直观的了解该问题。
=======Correct Font Setting =====
# Component Font Mappings
#
dialog.plain.0=Arial,ANSI_CHARSET
dialog.bold.0=Arial Bold,ANSI_CHARSET
dialog.italic.0=Arial Italic,ANSI_CHARSET
如上,plain应该使用字体XXX,bold则应该使用XXX Bold,italic则应该使用XXX Italic。
明白了问题的根结,找到解决问题的办法也就非常容易了。
对font.properties.zh中的相应Component Font Mappings段替换为下面部分。
# Component Font Mappings
#
dialog.plain.0=Arial,ANSI_CHARSET
dialog.plain.1=\u5b8b\u4f53,GB2312_CHARSET
dialog.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialog.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
dialog.bold.0=Arial Bold,ANSI_CHARSET
dialog.bold.1=\u5b8b\u4f53,GB2312_CHARSET
dialog.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialog.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
dialog.italic.0=Arial Italic,ANSI_CHARSET
dialog.italic.1=\u5b8b\u4f53,GB2312_CHARSET
dialog.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialog.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
dialog.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
dialog.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
dialog.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialog.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.plain.0=Courier New,ANSI_CHARSET
dialoginput.plain.1=\u5b8b\u4f53,GB2312_CHARSET
dialoginput.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.bold.0=Courier New Bold,ANSI_CHARSET
dialoginput.bold.1=\u5b8b\u4f53,GB2312_CHARSET
dialoginput.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.italic.0=Courier New Italic,ANSI_CHARSET
dialoginput.italic.1=\u5b8b\u4f53,GB2312_CHARSET
dialoginput.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.bolditalic.0=Courier New Bold Italic,ANSI_CHARSET
dialoginput.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
dialoginput.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
dialoginput.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
serif.plain.0=Times New Roman,ANSI_CHARSET
serif.plain.1=\u5b8b\u4f53,GB2312_CHARSET
serif.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
serif.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
serif.bold.0=Times New Roman Bold,ANSI_CHARSET
serif.bold.1=\u5b8b\u4f53,GB2312_CHARSET
serif.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
serif.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
serif.italic.0=Times New Roman Italic,ANSI_CHARSET
serif.italic.1=\u5b8b\u4f53,GB2312_CHARSET
serif.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
serif.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
serif.bolditalic.0=Times New Roman Bold Italic,ANSI_CHARSET
serif.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
serif.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
serif.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.plain.0=Arial,ANSI_CHARSET
sansserif.plain.1=\u5b8b\u4f53,GB2312_CHARSET
sansserif.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.bold.0=Arial Bold,ANSI_CHARSET
sansserif.bold.1=\u5b8b\u4f53,GB2312_CHARSET
sansserif.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.italic.0=Arial Italic,ANSI_CHARSET
sansserif.italic.1=\u5b8b\u4f53,GB2312_CHARSET
sansserif.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.bolditalic.0=Arial Bold Italic,ANSI_CHARSET
sansserif.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
sansserif.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
sansserif.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.plain.0=Courier New,GB2312_CHARSET
monospaced.plain.1=\u5b8b\u4f53,GB2312_CHARSET
monospaced.plain.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.plain.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.bold.0=Courier New Bold,GB2312_CHARSET
monospaced.bold.1=\u5b8b\u4f53,GB2312_CHARSET
monospaced.bold.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.bold.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.italic.0=Courier New Italic,GB2312_CHARSET
monospaced.italic.1=\u5b8b\u4f53,GB2312_CHARSET
monospaced.italic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.italic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.bolditalic.0=Courier New Bold Italic,GB2312_CHARSET
monospaced.bolditalic.1=\u5b8b\u4f53,GB2312_CHARSET
monospaced.bolditalic.2=WingDings,SYMBOL_CHARSET,NEED_CONVERTED
monospaced.bolditalic.3=Symbol,SYMBOL_CHARSET,NEED_CONVERTED
====End =====
重启Jbuilder,即可!最后,希望你也将你机器本地的JDK和JBuilder中自带的JDK中的font.properties.zh进行同样的修改为佳。font.properties.zh文件在{JDK_Home}/jre/lib目录下。