Package org.docx4j.fonts
Class BestMatchingMapper
java.lang.Object
org.docx4j.fonts.Mapper
org.docx4j.fonts.BestMatchingMapper
This mapper uses Panose to guess the physical font
which is a closest fit for the font used in the
document.
It is most likely to be suitable on Linux or OSX
systems which don't have Microsoft's fonts installed.
- Author:
- jharrop
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static org.slf4j.Loggerstatic final intMax difference for it to be considered an acceptable match.Fields inherited from class org.docx4j.fonts.Mapper
boldForms, boldItalicForms, FONT_FALLBACK, fontMappings, italicForms, regularForms -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final Map<String,MicrosoftFonts.Font> static voidvoidpopulateFontMappings(Set<String> documentFontNames, Fonts wmlFonts) Populate the fontMappings object.Methods inherited from class org.docx4j.fonts.Mapper
get, getBoldForm, getBoldItalicForm, getFontMappings, getItalicForm, getRegularForm, getSubstituteFontXsltExtension, getSubstituteFontXsltExtension, put, registerBoldForm, registerBoldItalicForm, registerItalicForm, registerRegularForm, size
-
Field Details
-
log
protected static org.slf4j.Logger log -
MATCH_THRESHOLD
public static final int MATCH_THRESHOLDMax difference for it to be considered an acceptable match. Note that this value will depend on the weights in the difference function.- See Also:
-
-
Constructor Details
-
BestMatchingMapper
public BestMatchingMapper()
-
-
Method Details
-
getMsFontsFilenames
-
populateFontMappings
Populate the fontMappings object. We make an entry for each of the documentFontNames.- Specified by:
populateFontMappingsin classMapper- Parameters:
documentFontNames- - the fonts used in the documentwmlFonts- - the content model for the fonts part- Throws:
Exception
-
main
- Throws:
Exception
-