Package org.docx4j.fonts
Class RunFontSelector
java.lang.Object
org.docx4j.fonts.RunFontSelector
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic interface -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRunFontSelector(WordprocessingMLPackage wordMLPackage, RunFontSelector.RunFontCharacterVisitor visitor, RunFontSelector.RunFontActionType outputType) -
Method Summary
Modifier and TypeMethodDescriptioncreateElement(Document document) fontSelector(PPr pPr, RPr rPr, String text) Apply font selection algorithm to this Text, based on supplied PPr, RPr (and docDefaults, Theme part etc).fontSelector(PPr pPr, RPr rPr, Text wmlText) Apply font selection algorithm to this Text, based on supplied PPr, RPr (and docDefaults, Theme part etc).voidsetAttribute(Element el, String fontName)
-
Field Details
-
log
protected static org.slf4j.Logger log -
CSS_NAME
- See Also:
-
FO_NAME
- See Also:
-
-
Constructor Details
-
RunFontSelector
public RunFontSelector(WordprocessingMLPackage wordMLPackage, RunFontSelector.RunFontCharacterVisitor visitor, RunFontSelector.RunFontActionType outputType)
-
-
Method Details
-
getCssName
-
getDefaultFont
-
createElement
-
setAttribute
-
fontSelector
Apply font selection algorithm to this Text, based on supplied PPr, RPr (and docDefaults, Theme part etc).- Parameters:
pPr-rPr-wmlText-- Returns:
-
fontSelector
Apply font selection algorithm to this Text, based on supplied PPr, RPr (and docDefaults, Theme part etc).- Parameters:
pPr-rPr-wmlText-- Returns:
-