The cursor problem in JB

Source: Internet
Author: User
Tags character set modify ranges
There is a long history of cursor problems in problem jbuilder, from JB4 (I used the first JB version, another: This article in the JB is jbuilder abbreviation) to the latest JBX, in general code with bold or italic line, the cursor always appear in the wrong position, to bring a lot of inconvenience, Affect the programmer's mood and efficiency. The early solution was primarily to modify the code display scheme for the JBuilder itself, or to change the font, or to revise all bold and italic and coarse italics to normal fonts. Although these methods can basically solve the problem of incorrect cursor position, but all affect the visual effects to a certain extent or lower the code syntax for JB, such as in the JBX neutron class if a method defined in the parent class is overridden, the method name in the subclass is italic. Later, with the development of JB, more and more people affected by this problem, more and more people feel uncomfortable, so there is a master of this problem traced back, the original problem is the real source of the JRE rather than JB. There are some Font property files (<jre_dir>/lib/font.properties*) that are defined in the JRE for different country regions and languages. The contents of FONT.PROPERTIES.ZH documents related to China are somewhat improper, which leads to the above problems. It also explains why other countries and Taiwan have had little such problems (unless the region of her operating system is selected in mainland China). But why is it that only JB has such problems, while other Java programs that run on the JRE do not have such problems? The main thing is that other programs rarely use bold and italic, and the fonts used are also related to the cursor dislocation only if you use the bold and italics of the combined font (Component font) listed in Font.properties.zh. There have been previous changes to this file on the web, such as adding need_converted and modifying exclusion Ranges, and cannot fundamentally solve the problem.

Since only users in mainland China have encountered such problems, the corresponding font.properties* files in other regions should be fine. In contrast to the Font.properties file, you can see where the problem is in Font.properties.zh--The Combination Font mapping section (Component font mappings) for bold and italic for each font, are mapped to regular fonts, and are not mapped to the corresponding bold and italic, which causes applications such as JB to be in the width of the regular font when calculating the width of bold or italic characters, which in turn results in a mismatch between the display position and the actual position of the cursor. such as dialoginput.bold.0, corresponding to the font for Courier new, bold English letters, the correct mapping should be Dialoginput.bold.0=courier New Bold,ansi_charset, In Font.properties.zh, the map is Dialoginput.bold.0=courier new,ansi_charset (note: no bold).

In this case, the Font.properties.zh can be modified to add any incorrect mappings bold,italic or bold italic respectively. So JB and other Java programs will not have the problem of cursor dislocation.

It should also be noted that the Font.properties file name that really corresponds to the mainland of China should be font.properties.zh_CN, and because the JRE does not have this file by default, the closest file Font.properties.zh will be used. Therefore, if there is a font.properties.zh_CN under the <jre_dir>/lib/, the file should be modified first. In addition, the font.properties.zh.98 file may be used in the Windows 9X system, so if the operating system is Windows 9X, modify the file.
The contents of the modified Font.properties.zh file are attached:


# @ (#) font.properties.zh1.10 02/03/07
#
# Copyright 2002 Sun Microsystems, Inc. All rights reserved.
# Modified by Yue Feng. 11/24/2003

# Component Font Mappings
#
Dialog.plain.0=arial,ansi_charset
Dialog.plain.1=\u5b8b\u4f53,gb2312_charset
Dialog.plain.2=wingdings,symbol_charset
Dialog.plain.3=symbol,symbol_charset

Dialog.bold.0=arial Bold,ansi_charset
Dialog.bold.1=\u5b8b\u4f53,gb2312_charset
Dialog.bold.2=wingdings,symbol_charset
Dialog.bold.3=symbol,symbol_charset

Dialog.italic.0=arial Italic,ansi_charset
Dialog.italic.1=\u5b8b\u4f53,gb2312_charset
Dialog.italic.2=wingdings,symbol_charset
Dialog.italic.3=symbol,symbol_charset

Dialog.bolditalic.0=arial Bold Italic,ansi_charset
Dialog.bolditalic.1=\u5b8b\u4f53,gb2312_charset
Dialog.bolditalic.2=wingdings,symbol_charset
Dialog.bolditalic.3=symbol,symbol_charset

Dialoginput.0=courier New,ansi_charset
Dialoginput.1=\u5b8b\u4f53,gb2312_charset
Dialoginput.2=wingdings,symbol_charset
Dialoginput.3=symbol,symbol_charset

Dialoginput.plain.0=courier New,ansi_charset
Dialoginput.plain.1=\u5b8b\u4f53,gb2312_charset
Dialoginput.plain.2=wingdings,symbol_charset
Dialoginput.plain.3=symbol,symbol_charset

Dialoginput.bold.0=courier New Bold,ansi_charset
Dialoginput.bold.1=\u5b8b\u4f53,gb2312_charset
Dialoginput.bold.2=wingdings,symbol_charset
Dialoginput.bold.3=symbol,symbol_charset

Dialoginput.italic.0=courier New Italic,ansi_charset
Dialoginput.italic.1=\u5b8b\u4f53,gb2312_charset
Dialoginput.italic.2=wingdings,symbol_charset
Dialoginput.italic.3=symbol,symbol_charset

Dialoginput.bolditalic.0=courier New Bold Italic,ansi_charset
Dialoginput.bolditalic.1=\u5b8b\u4f53,gb2312_charset
Dialoginput.bolditalic.2=wingdings,symbol_charset
Dialoginput.bolditalic.3=symbol,symbol_charset

Serif.plain.0=times New Roman,ansi_charset
Serif.plain.1=\u5b8b\u4f53,gb2312_charset
Serif.plain.2=wingdings,symbol_charset
Serif.plain.3=symbol,symbol_charset

Serif.bold.0=times New Roman Bold,ansi_charset
Serif.bold.1=\u5b8b\u4f53,gb2312_charset
Serif.bold.2=wingdings,symbol_charset
Serif.bold.3=symbol,symbol_charset

Serif.italic.0=times New Roman Italic,ansi_charset
Serif.italic.1=\u5b8b\u4f53,gb2312_charset
Serif.italic.2=wingdings,symbol_charset
Serif.italic.3=symbol,symbol_charset

Serif.bolditalic.0=times New Roman Bold italic,ansi_charset
Serif.bolditalic.1=\u5b8b\u4f53,gb2312_charset
Serif.bolditalic.2=wingdings,symbol_charset
Serif.bolditalic.3=symbol,symbol_charset

Sansserif.plain.0=arial,ansi_charset
Sansserif.plain.1=\u5b8b\u4f53,gb2312_charset
Sansserif.plain.2=wingdings,symbol_charset
Sansserif.plain.3=symbol,symbol_charset

Sansserif.bold.0=arial Bold,ansi_charset
Sansserif.bold.1=\u5b8b\u4f53,gb2312_charset
Sansserif.bold.2=wingdings,symbol_charset
Sansserif.bold.3=symbol,symbol_charset

Sansserif.italic.0=arial Italic,ansi_charset
Sansserif.italic.1=\u5b8b\u4f53,gb2312_charset
Sansserif.italic.2=wingdings,symbol_charset
Sansserif.italic.3=symbol,symbol_charset

Sansserif.bolditalic.0=arial Bold Italic,ansi_charset
Sansserif.bolditalic.1=\u5b8b\u4f53,gb2312_charset
Sansserif.bolditalic.2=wingdings,symbol_charset
Sansserif.bolditalic.3=symbol,symbol_charset

Monospaced.0=courier New,ansi_charset
Monospaced.plain.1=\u5b8b\u4f53,gb2312_charset
Monospaced.plain.2=wingdings,symbol_charset
Monospaced.plain.3=symbol,symbol_charset

Monospaced.bold.0=courier New Bold,ansi_charset
Monospaced.bold.1=\u5b8b\u4f53,gb2312_charset
Monospaced.bold.2=wingdings,symbol_charset
Monospaced.bold.3=symbol,symbol_charset

Monospaced.italic.0=courier New Italic,ansi_charset
Monospaced.italic.1=\u5b8b\u4f53,gb2312_charset
Monospaced.italic.2=wingdings,symbol_charset
Monospaced.italic.3=symbol,symbol_charset

Monospaced.bolditalic.0=courier New Bold Italic,ansi_charset
Monospaced.bolditalic.1=\u5b8b\u4f53,gb2312_charset
Monospaced.bolditalic.2=wingdings,symbol_charset
Monospaced.bolditalic.3=symbol,symbol_charset

# 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
It should be stated that JB uses his own JRE instead of the JRE in the system, so it is only valid to modify the Font.properties file in Jre/lib in the JDK directory under the JB installation directory.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.