- java.lang.Object
-
- org.icepdf.ri.util.FontPropertiesManager
-
public class FontPropertiesManager extends Object
This class provides a basic Font Properties Management system. In order for font substitution to work more reliable it is beneficial that it has read and cached all system fonts. The scanning of system fonts can be time consuming and negatively effect the startup time of the library. To speed up subsequent launches of the PDF library the fonts are stored using the Preferences API using a backing store determined by the JVM.
// read/store the font cache. FontPropertiesManager.getInstance().loadOrReadSystemFonts();NOTE: This class was significantly simplified in version 6.3 of ICEpdf and the release notes should be consulted if any custom font loading was implemented by the end user.
- Since:
- 6.3
-
-
Field Summary
Fields Modifier and Type Field Description static StringPREFERENCES_KEY_CLASS
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearProperties()Clears the backing store of all font properties.static FontManagergetFontManager()Gets the underlying fontManger instance which is also a singleton.static FontPropertiesManagergetInstance()Gets the singleton instance of the FontPropertiesManager.booleanisFontPropertiesEmpty()Check to see if any font properties are stored in the backing store.voidloadOrReadSystemFonts()Checks to see if there is currently any cached properties in the the backing store; if so they are returned, otherwise a full read of the system fonts takes place and the results are stored in the backing store.voidloadProperties()Loads any font properties stored in the backing store and are passed to theFontManagerclass.voidreadDefaultFontProperties(String... paths)Reads the default font paths as defined by theFontManagerclass.voidreadFontProperties(String... paths)Reads the only font paths defined by the param paths.voidsaveProperties()Saves all fonts properties defined in theFontManagerto the backing store.
-
-
-
Field Detail
-
PREFERENCES_KEY_CLASS
public static final String PREFERENCES_KEY_CLASS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static FontPropertiesManager getInstance()
Gets the singleton instance of the FontPropertiesManager.- Returns:
- instance of FontPropertiesManager.
-
loadOrReadSystemFonts
public void loadOrReadSystemFonts()
Checks to see if there is currently any cached properties in the the backing store; if so they are returned, otherwise a full read of the system fonts takes place and the results are stored in the backing store.
-
readDefaultFontProperties
public void readDefaultFontProperties(String... paths)
Reads the default font paths as defined by theFontManagerclass. This method does not save any fonts to the backing store.- Parameters:
paths- any extra paths that should be read as defined by the end user.
-
readFontProperties
public void readFontProperties(String... paths)
Reads the only font paths defined by the param paths. This method does not save any fonts to the backing store or read system fonts as defined byFontManager.readSystemFonts(String[]).- Parameters:
paths- paths that should be read for system fonts.
-
loadProperties
public void loadProperties()
Loads any font properties stored in the backing store and are passed to theFontManagerclass. No changes are made to the backing store.
-
clearProperties
public void clearProperties()
Clears the backing store of all font properties.
-
saveProperties
public void saveProperties()
Saves all fonts properties defined in theFontManagerto the backing store.
-
isFontPropertiesEmpty
public boolean isFontPropertiesEmpty()
Check to see if any font properties are stored in the backing store.- Returns:
- true if font properties backing store is empty, otherwise false.
-
getFontManager
public static FontManager getFontManager()
Gets the underlying fontManger instance which is also a singleton.- Returns:
- current font manager
-
-