Thai Fonts on OpenJDK / Azul Zulu Builds of OpenJDK

In some situations, text written in Thai isn't displayed correctly on Windows when running an application on OpenJDK or Azul Zulu Builds of OpenJDK. Rectangular placeholder signs are then showed instead of the correct Thai glyphs. As solution, point the JRE to a different font of the operating system, for example Tahoma is a good choice, which provides more Thai glyphs than the JRE's default choice of Lucida Sans Regular.

Configuration steps to change the JRE's default font choice for Thai:

First, locate your JRE installation directory. Here as placeholder I use JREHOME.

From there, copy the file JREHOME/lib/fontconfig.properties.src to a directory related to the application you like to run or to some other place which won't be overwritten on later JRE updates and use as filename fontconfig.properties (without the .src in the end). For example:

MYDIR/fontconfig.properties

In MYDIR/fontconfig.properties change the entries allfonts.thai, sequence.allfonts and sequence.fallback, to the following:

allfonts.thai=Tahoma
sequence.allfonts=alphabetic/default,dingbats,symbol,thai
sequence.fallback=lucida,symbols,\
                  chinese-ms950,chinese-hkscs,chinese-ms936,chinese-gb18030,\
                  japanese,korean,chinese-ms950-extb,chinese-ms936-extb,georgian,thai

We changed the default font to Tahoma and appended thai in the 2 other parameters.

Now change the java command line used to start the application to point to this new file, for example:

java -Dsun.awt.fontconfig=MYDIR/fontconfig.properties -jar myapp.jar

If you try it out on the Windows Powershell console, you have to enclose the parameter with quotes:

java '-Dsun.awt.fontconfig=MYDIR/fontconfig.properties' -jar myapp.jar

That's all. Later when you upgrade the JRE, no change is needed as you placed the new configuration file outside of the JRE directory to avoid it to be overwritten or deleted during upgrades.

For other languages or writing systems this solution can also be applied. Then instead of appending "thai" in the two parameters, use the abbreviation of that language. See JDK-8008572 as examples.

Add Comment

Comments

0 comments

Please sign in to leave a comment.

Was this article helpful?
0 out of 0 found this helpful