Font Installation and Text Insertion
To generate documents with CJK fonts, the Adobe Acrobat Asian Language Pack must be installed on the machine. You can choose to install one or all of the three languages supported by the pack: Chinese, Japanese and Korean. The language pack installs CID fonts for each of the selected languages.
CID fonts use the same format as TrueType fonts. However, the internal tables in the fonts are slightly different from regular TrueType fonts. Therefore, the CID fonts installed by the language pack cannot be used in Java (or OS) as regular fonts. In order to create a CJK document, a regular TrueType font also needs to be installed on the machine for the language. We will use Japanese as the example font in the following discussions. Chinese and Korean fonts are handled in the same way.
To create a document containing Japanese characters, first select the correct Japanese TrueType font (OS font) for the report element:
// "MS Mincho" is a TrueType Japanese font
report.setCurrentFont(new Font("MS Mincho", Font.PLAIN, 8));
Then we can insert the Japanese text into the report using the same StyleSheet API:
layout.addText("This is a Japanese character: \u1083");
If the report is created from a report template, the Japanese characters can be entered in the Designer and saved in the template file. The template file uses UTF8 encoding for text values and can handle all unicode characters correctly.