Package org.docx4j.fonts
Class PhysicalFonts
java.lang.Object
org.docx4j.fonts.PhysicalFonts
The fonts which are physically installed on the system.
They can be discovered automatically, or you can
just add specific fonts.
Do NOT add fonts embedded in a docx to physicalFontMap!
- Author:
- dev
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddPhysicalFont(URI fontUrl) Add a physical font's EmbedFontInfo object.static voidaddPhysicalFonts(String nameAsInFontTablePart, URI fontUrl) Add a physical font's EmbedFontInfo object.static final voidAutodetect fonts available on the system.static PhysicalFontGet a PhysicalFont by case-insensitive name.static PhysicalFontstatic PhysicalFontstatic PhysicalFontstatic List<PhysicalFont>getPhysicalFont(String nameAsInFontTablePart, URI fontUrl) Get a physical font's EmbedFontInfo object.static StringgetPhysicalFont(OpcPackage wmlPackage, String fontName) static Map<String,PhysicalFont> Deprecated.static StringgetRegex()static voidstatic voidput(String key, PhysicalFont pf) Put a PhysicalFont by case-insensitive name.static voidSet a regex to limit to the common fonts in order to lower memory use.
-
Field Details
-
log
protected static org.slf4j.Logger log -
fontCache
-
-
Constructor Details
-
PhysicalFonts
public PhysicalFonts()
-
-
Method Details
-
getPhysicalFonts
Deprecated. -
get
Get a PhysicalFont by case-insensitive name. (Although Word always uses Title Case for font names, it is actually case insensitive; the spec is silent on this.)- Parameters:
key-- Returns:
-
put
Put a PhysicalFont by case-insensitive name. (Although Word always uses Title Case for font names, it is actually case insensitive; the spec is silent on this.)- Parameters:
key-pf-
-
getRegex
-
setRegex
Set a regex to limit to the common fonts in order to lower memory use. eg on Mac regex=".*(Courier New|Arial|Times New Roman|Comic Sans|Georgia|Impact|Lucida Console|Lucida Sans Unicode|Palatino Linotype|Tahoma|Trebuchet|Verdana|Symbol|Webdings|Wingdings|MS Sans Serif|MS Serif).*"; on Windows: regex=".*(calibri|cour|arial|times|comic|georgia|impact|LSANS|pala|tahoma|trebuc|verdana|symbol|webdings|wingding).*"; If you want to use this, set it before instantiating a Mapper.- Since:
- 2.8.1
-
discoverPhysicalFonts
Autodetect fonts available on the system.- Throws:
Exception
-
addPhysicalFont
Add a physical font's EmbedFontInfo object. Not to be used for embedded fonts.- Parameters:
fontUrl- eg new java.net.URL("file:" + path)
-
addPhysicalFonts
Add a physical font's EmbedFontInfo object. Not to be used for embedded fonts.- Parameters:
fontUrl- eg new java.net.URL("file:" + path)
-
getPhysicalFont
Get a physical font's EmbedFontInfo object.- Parameters:
fontUrl- eg new java.net.URL("file:" + path)
-
getBoldForm
-
getBoldItalicForm
-
getItalicForm
-
getPhysicalFont
-
main
- Throws:
Exception
-