Class FontRegisterProvider
java.lang.Object
com.itextpdf.io.font.FontRegisterProvider
If you are using True Type fonts, you can declare the paths of the different ttf- and ttc-files
to this class first and then create fonts in your code using one of the getFont method
without having to enter a path as parameter.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoid(package private) FontProgramConstructs aFont-object.(package private) FontProgramConstructs aFont-object.protected FontProgramgetFontProgram(String fontName, boolean cached) Gets a set of registered font names.Gets a set of registered font names.(package private) booleanisRegisteredFont(String fontname) Checks if a certain font is registered.(package private) voidregisterFont(String path) Register a font file, either .ttf or .otf, .afm or a font from TrueType Collection.(package private) voidregisterFont(String path, String alias) Register a font file and use an alias for the font contained in it.(package private) intRegister all the fonts in a directory.(package private) intregisterFontDirectory(String dir, boolean scanSubdirectories) Register all the fonts in a directory and possibly its subdirectories.(package private) voidregisterFontFamily(String familyName, String fullName, String path) Register a font by giving explicitly the font family and name.protected voidprotected void(package private) intRegister fonts in some probable directories.(package private) booleansaveCopyOfRegularFont(String regularFontName, String path)
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
fontNames
-
fontFamilies
-
-
Constructor Details
-
FontRegisterProvider
FontRegisterProvider()Creates new FontRegisterProvider
-
-
Method Details
-
getFont
Constructs aFont-object.- Parameters:
fontName- the name of the fontstyle- the style of this font- Returns:
- the Font constructed based on the parameters
- Throws:
IOException
-
getFont
Constructs aFont-object.- Parameters:
fontName- the name of the fontstyle- the style of this fontcached- true if the font comes from the cache or is added to the cache if new, false if the font is always created new- Returns:
- the Font constructed based on the parameters
- Throws:
IOException
-
registerStandardFonts
protected void registerStandardFonts() -
registerStandardFontFamilies
protected void registerStandardFontFamilies() -
getFontProgram
- Throws:
IOException
-
registerFontFamily
-
registerFont
Register a font file, either .ttf or .otf, .afm or a font from TrueType Collection. If a TrueType Collection is registered, an additional index of the font program can be specified- Parameters:
path- the path to a ttf- or ttc-file
-
registerFont
-
saveCopyOfRegularFont
-
registerFontDirectory
Register all the fonts in a directory.- Parameters:
dir- the directory- Returns:
- the number of fonts registered
-
registerFontDirectory
Register all the fonts in a directory and possibly its subdirectories.- Parameters:
dir- the directoryscanSubdirectories- recursively scan subdirectories iftrue- Returns:
- the number of fonts registered
-
registerSystemFontDirectories
int registerSystemFontDirectories()Register fonts in some probable directories. It usually works in Windows, Linux and Solaris.- Returns:
- the number of fonts registered
-
getRegisteredFonts
-
getRegisteredFontFamilies
-
isRegisteredFont
Checks if a certain font is registered.- Parameters:
fontname- the name of the font that has to be checked.- Returns:
- true if the font is found
-
clearRegisteredFonts
public void clearRegisteredFonts() -
clearRegisteredFontFamilies
public void clearRegisteredFontFamilies()
-