Using font resources for graphic languages ​​in Java 1.4

I have the following problem using java 1.4

I am trying to display a very simple HTML document in a JTextPane that contains Chinese characters.

If the locale used when the Java Virtual Machine starts is user.language = zh and user.country = CN, the graphics are displayed correctly.

For any other locale, characters are displayed as squares.

The difference I can see is that java 1.4 uses a different font.properties file for each locale. In this particular case, the font.properties.zh file contains an additional entry:

dialog.plain.0=Arial,ANSI_CHARSET 
**dialog.plain.1=\u5b8b\u4f53,GB2312_CHARSET**
dialog.plain.1=WingDings,SYMBOL_CHARSET
dialog.plain.2=Symbol,SYMBOL_CHARSET

      

This entry is no longer available for other locales.

The problem I am having is that I need to be able to display this string using any locale. Also, I cannot change the font.properties file to add additional entries as I have no control over the JVM used by the client.

In Java 1.5, this problem does not occur.

Is there a way to add this mapping programmatically? Is there any other solution?

0


source to share


1 answer


Apparently the answer is ...

Not possible for java 1.4 according to this url:

http://java.sun.com/javase/technologies/core/basic/intl/faq.jsp#desktop-rendering



Using logical font names:

  • Benefits: These font names are guaranteed to work anywhere, and they allow text to be rendered in at least the language in which the local operating system is localized (often a much larger range of languages).

  • Disadvantages: The physical fonts used to render text differ between different implementations, operating systems, and host locales, so the application cannot achieve the same look and feel. In addition, display engines sometimes limit the range of characters that can be displayed. The latter was a big problem for JRE versions prior to 5.0: for example, Japanese text could only be displayed on local local operating systems in Japan, and not on other localized systems, even if Japanese fonts were installed. For applications that use 2D font rendering, this issue is much less common with JRE 5.0 because the mapping engine now generally recognizes and uses fonts for all supported writing systems, if installed.

The only possible way seems to be to install a font that has extended graphics support in hardcoded form in a component.

0


source







All Articles