2. Java , Installanywhere 在 Redhat 上的中文问题解决方法 jacklondon [原作]
标准 jre/jdk 中只带了 redhat 6 的 font.properties, 我在 redhat 7.3 和 redhat 8.0 上都不能用。我们需要建一个 font.properties.zh.Redhat 放在 redhat 的 jre/lib 目录下。打开 /usr/lib/X11/fonts/ttf-zh 或者 /usr/share/fonts/zh_CN/TrueType 下面的 font.dir, 将其中的一个中文字体名复制下来,比如 -misc-ZYSong18030-medium-r-normal--0-0-0-0-c-0-iso10646-1,按照 java 的字体规则改为 -misc-ZYSong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1,将 font.properties.zh 中的内容复制到 font.properties.zh.Redhat 中。
我选用字体 -misc-ZYSong18030-medium-r-normal--0-0-0-0-c-0-iso10646-1 是因为在 redhat 7.3 和 redhat 8.0 上都能用。
因为 jre/jdk 找不到 Redhat 的 true type 字体,在文件 font.properties.zh.Redhat 最后加入
appendedfontpath=/usr/lib/X11/fonts/ttf-zh
appendedfontpath=/usr/share/fonts/zh_CN/TrueType
将字体名全部替换成 -misc-ZYSong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/79499/viewspace-442/,如需转载,请注明出处,否则将追究法律责任。