You may also find useful Carrying template fonts to the generated report.
Office documents have a locale (language & country) setting. This is generally set for the document as a whole, but any part of the document can be set to a different locale. There are three locale settings, Latin, ComplexScript (includes bi-di), and EastAsia. The locale for any text in the document depends on the characters in the text so English letters use the Latin locale while Chinese use the EastAsia locale.
The documents also have 4 fonts assigned anywhere a font is specified. These 4 fonts are used depending on the characters typed. There is the ascii font setting for all the standard Latin letters, numbers, punctuation, etc. (think English). There is the high-ansi for all additional letters except for complex scripts (primarily Arabic & Hebrew) and east-asian. High-ansi is primarily for all the additional letters used in European alphabets as well as alphabets like Greek, Cyrillic, etc. The third font is the complex-script font and 4th is the east-asian font.
The font used is based on the characters in the section formatted. This is how you can have a line of text that is a mix of English and Chinese and the English is in Times New Roman while the Chinese is in MS Mincho where Office switches between the two depending on the letter typed.
The font can either be an explicit font or set to a theme font. When a font is set to a theme, then the locale setting determines which font to use. The theme fonts have a font for Latin, ComplexScript, and EastAsia. They also have optional settings for specific languages (not locales/countries) and if that font is set for the locale (language part) of the text, then that specific font is used.
In the file Office saves (DOCX, PPTX, & XLSX), it will put a character formatting setting every time the text changes between any of the 4 categories. So any run of text in the file is all a single font category. And that single category is used when creating a report in the PDF, HTML, etc. format where a single font must be specified.
Text from an out tag
When an out tag places text into the report, that text can be a different category than ascii (tags are always in the ascii font because they are composed of just standard latin letters). In version 10 - 12.0 the entire paragraph of text, including the inserted text from the out tag, is upgraded if needed based on the text from the tag. So inserting Chinese in a paragraph will change the entire paragraph to MS Mincho (or whatever east-asia font is specified).
Starting with version 13, the rest of the paragraph is left alone and just the text from the out tag is set to the proper font category for the text being inserted. If the text returned by the out tag is from several categories, then it will use the first non-ascii category character for the setting.
Starting with version 13, if the font specified does not have glyphs for the characters in the text, then Windward will substitute in one of several substitution fonts (you can override the backup fonts in your properties). It will use the font that has the best coverage of all the characters in the run of text. It will not split up substitution, a single run of text will get a single substitute font.
BI-DI (Arabic & Hebrew)
If a section is marked rtl (Right To Left), then Windward uses the complex-script font.
Also, forEach, if, and other tags with a start/finish go from the right part of a table, paragraph, etc. to the left part. But this occurs on the basis of how that part of the document is marked, not on what the default is. So a LTR table in an otherwise RTL document will work the same as a LTR table in a document set to English.
There are limitations in the iText library that impact Arabic output. If you have Arabic output:
- Set line.breaks=external in your properties. If you set it to internal the line breaks will be incorrect for some Arabic fonts.
- If you use the font Simplified Arabic, then for PDF output set ProcessPdf.setFontLevel(ProcessPdf.FONT_NO_EMBED); If you set it to EMBED, then some glyphs will not show up in your output.