Class RunFontSelector

java.lang.Object
org.docx4j.fonts.RunFontSelector

public class RunFontSelector extends Object
Apply the appropriate font to the characters in the run, following the rules specified in http://webapp.docx4java.org/OnlineDemo/ecma376/WordML/rFonts.html and http://msdn.microsoft.com/en-us/library/ff533743.aspx ([MS-OI29500] 2.1.87) See also http://blogs.msdn.com/b/officeinteroperability/archive/2013/04/22/office-open-xml-themes-schemes-and-fonts.aspx The ASCII font formats all characters in the ASCII range (character values 0–127). This font is specified using the ascii attribute on the rFonts element. The East Asian font formats all characters that belong to Unicode sub ranges for East Asian languages. This font is specified using the eastAsia attribute on the rFonts element. The complex script font formats all characters that belong to Unicode sub ranges for complex script languages. This font is specified using the cs attribute on the rFonts element. The high ANSI font formats all characters that belong to Unicode sub ranges other than those explicitly included by one of the groups above. This font is specified using the hAnsi attribute on the rFonts element. Per Tristan Davis http://openxmldeveloper.org/discussions/formats/f/13/t/150.aspx First, the characters are classified into the high ansi / east asian / complex script buckets [per above] Next, we grab *one* theme font from the theme for each bucket - in the settings part, there's an element called themeFontLang The three attributes on that specify the language to use for the characters in each bucket Then you take the language specified for each attribute and look out for the right language in the theme - and you use that font See also http://blogs.msdn.com/b/officeinteroperability/archive/2013/04/22/office-open-xml-themes-schemes-and-fonts.aspx regarding what to do if the font is not available on the computer.
Author:
jharrop