Summary of some issues in Chinese display in java programs under Linux

xiaoxiao2021-03-06  143

Here, it is generally referred to, not a web app. (Or a statistical graphic generated in the web app)

General processing principle: 1. There is a Chinese font 2.jre can find Chinese font 3. Font.properties.xx.xx and your system correctly

I use Red Hat Enterprise Linux As Release 3 (Taroon Update 2), LANG = ZH_CN.GB18030, JDK 1.4.2_02 as an example, say the process

(If you have to change according to your own situation, don't move, for example, I will not be on the following.)

1. Discover the presence Chinese font / usr / share / fonts / zh_cn / trueType

2. There is font.properties.zh_cn.red.properties.zh_cn.red.properties, but my redhat is not 8.0, it is changed to redhat, so copy a copy to font.properties.zh_cn.redhat, look at the content, find inside A Chinese font has been set, and the last line also specifies the path to the Chinese font, so it does not have to modify anything.

3. Restart the program / or WebServer, OK shows successful

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The following content is extracted from all walks of life.

1. Mandrake Linux 8.2, JDK 1.4.1 ([Author: home cat])

=================================================

Many friends discover that Chinese display is not normal when using Java to develop applications under Linux, and the Chinese in the window application is displayed as a series of blocks. This is mainly due to the incorrect font settings. In the configured profile of JDK, it is not existed by the Chinese font. This article uses Mandrake Linux 8.2, JDK 1.4.1 as an example, simply introduces the setting method of the Java Chinese environment under Linux. Other Linux systems or JDK versions can be adjusted accordingly. First, check if your / usr / share / fonts / ttf / gb directory is equipped with Chinese font GBSN00LP.TTF. If not, you can also replace Song.ttf in the Windows Font Code. Copy the font file to JRE / LIB / FONTS under the Java installation directory. Second, modify the JRE / lib / fonts / fonts.dir file in the Java installation directory, change the 72 of the first line to 73, then add the following: GBSN00LP.TTTTTF -ARPHIC TECHNOLOGY Co.-AR PL SUNGTIL GB-Medium- R-NORMAL - 0-0-0-0-C-0-GB2312.1980-0 Note: If you use Song.TTTF, you should change the GBSN00LP.ttf of the head to Song.ttf. Third, in the JRE / LIB directory in the Java installation directory, copy the font configuration file font.properties.zh.TurboRoProperties.zh. Then modify font.properties.en. Replace all: -tlc-song-medium-r-normal - * -% d - * - * - c - * - GBK-0 to: -arphic technology Co.-am Pl Sungtil GB-Medium- R-NORMAL - 0-0-0-0- C-0-GB2312.1980-0 Fourth, use the JDK's own demo SWINGSET2 test, if you see the Chinese menu, the setting is successful. =================================================

2. Java, installanywhere on the Chinese problem solving on redhat Jacklondon [original]

Standard JRE / JDK only with Redhat 6 font.properties, I can't use it on Redhat 7.3 and RedHat 8.0. We need to build a font.properties.zh.Redhat placed in the redhat's JRE / LIB directory. Open / USR / LIB / X11 / FONTS / TTF-ZH or / USR / Share / FONTS / ZH_CN / TRUETYPE below Font.dir, copy one of the Chinese characters, such as -Misc-zysong18030-medium-r- NORMAL - 0-0-0-0-C-0-ISO10646-1, changed to -Misc-zysong18030-media-r-normal - * -% D - * - * - C- * in accordance with Java font rules -ISO10646-1, copy the contents of Font.properties.en to Font.properties.zh.Redhat. I use font -Misc-zysong18030-medium-r-normal - 0-0-0-0-C-0-ISO10646-1 because it can be used on RedHat 7.3 and RedHat 8.0.

Because JRE / JDK can't find the REDHAT TRUE TYPE font, finally join the file font.properties.zh.redhat

AppendedFontPath = / usr / lib / x11 / fonts / ttf-zhappendedfontpath = / usr / share / fonts / zh_cn / trueType

Replace all the font names into -Misc-zysong18030-medium-r-normal - * -% D - * - * - C - * - ISO10646-1

转载请注明原文地址:https://www.9cbs.com/read-127946.html

New Post(0)