JBuilder2005中文乱码问题

1. 光标定位问题的解决:
(方法一)
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目录下。


(方法二)

在上述操作后,有可能会出先弹出菜单的中文变成小方块,所以采用另一种方法,如下:

将jre/lib目录中的font.properties.zh文件替换为如下内容:

# @(#)font.properties.zh        1.10 02/03/07
#
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
#

# 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

# Font File Names
#
filename.//u5b8b//u4f53=SIMSUN.TTC

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.WingDings=WINGDING.TTF
filename.Symbol=SYMBOL.TTF

# Missing Glyph Character
#
default.char=2751

# Component Font Character Encodings

#
fontcharset.dialog.1=sun.io.CharToByteGBK
fontcharset.dialog.2=sun.awt.windows.CharToByteWingDings
fontcharset.dialog.3=sun.awt.CharToByteSymbol

fontcharset.dialoginput.1=sun.io.CharToByteGBK
fontcharset.dialoginput.2=sun.awt.windows.CharToByteWingDings
fontcharset.dialoginput.3=sun.awt.CharToByteSymbol

fontcharset.serif.1=sun.io.CharToByteGBK
fontcharset.serif.2=sun.awt.windows.CharToByteWingDings
fontcharset.serif.3=sun.awt.CharToByteSymbol

fontcharset.sansserif.1=sun.io.CharToByteGBK
fontcharset.sansserif.2=sun.awt.windows.CharToByteWingDings
fontcharset.sansserif.3=sun.awt.CharToByteSymbol

fontcharset.monospaced.0=sun.io.CharToByteGBK
fontcharset.monospaced.1=sun.io.CharToByteGBK
fontcharset.monospaced.2=sun.awt.windows.CharToByteWingDings
fontcharset.monospaced.3=sun.awt.CharToByteSymbol

# Exclusion Ranges
#
exclusion.dialog.0=0100-20ab,20ad-f8ff

exclusion.dialoginput.0=0100-20ab,20ad-f8ff
exclusion.serif.0=0100-20ab,20ad-f8ff
exclusion.sansserif.0=0100-20ab,20ad-f8ff
exclusion.monospaced.0=0100-20ab,20ad-f8ff

# Text Input Character Set
#
inputtextcharset=GB2312_CHARSET

(方法三)

此方法最简单而且非常好用,只需改动一处即可:

找到c:/Borland/JBuilder2005/bin/jbuilder.config配置文件,
在这个文件的第26行后加入:
vmparam -Dprimetime.editor.useVariableWidthFont=true,且参数vmparam和其后的参数值间应有空格
重新启动JBuilder2005就可以了.(已经过测试)

 


2. 中文显示问题

JBuilder X 安装后编辑器的字体文件列表只有两个, 这样给改变编辑器字体带来了困难. 解决办法: 将 JBuilder 9 的编辑器配置文件复制到 JBuilder X 的设置目录下即可.
Windows 2000 下的操作方法:
将文件 C:/Documents and Settings/{CURRENT_USER}/.jbuilder9/user_zh.properties
复制到目录 C:/Documents and Settings/{CURRENT_USER}/.primetimeX 下即可, 注意不是复制到 /.jbuilderX 目录下.
如果您希望添加其他的字体文件列表到里面, 简单的修改里面的字体文件名即可, 不过这些字体的中文名称是使用 /uXXXX 序列编码的. 具体就是添加一行
editor.display;known_fonts.数字=Font Name

给大家一个现成的例子: 将下列内容保存到文件 user_zh.properties, 然后复制到 {系统盘符}:/Documents and Settings/{CURRENT_USER}/.primetimeX 下即可, 注意不是复制到 /.jbuilderX 目录下.
---------------------------
中文问题解决: 
方法一: 
   下载最新版的JDK把jre/lib下的font.properties.zh盖掉JBX所用的JDK相同目录JBX/jdk1.4/jre/lib下的相同文件就行了。 

方法二: 
   Project  =>  Project  Properties  =>  General  =>  Encoding  =>改为GBK。 

方法三:步骤如下: 
1:  安装JBX;不用说了; 

2:  改变一下,Tools  =>  Preferences...  =>  Editor  =>  Display  里面的字体,主要是让JBuilderX搜索一下系统的字体; 

3:  关闭JBX; 

4:  在用户主目录下(X://Documents  and  Settings//Administrator//) 
  打开.primetimeX//user_zh.properties 
  将所有的editor.display;known_fonts.***=***拷贝出来; 
  新建一个文件,粘贴过去然后把这里的known_fonts全部替换成fixed_fonts,然后拷贝所有,回到user_zh.properties文件来; 
  替换掉这里的所有的editor.display;fixed_fonts.***=***行,保存; 

5:  重起JBX,Tools  =>  Preferences...  =>  Editor  =>  Display  ==>  Font  Family里面的字体是全部Windows的字体了。

你可能感兴趣的:(jbuilder,character,fonts,jdk,sun,borland)