public final class FontProgramFactory extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
clearRegisteredFontFamilies()
Clears registered font cache
|
static void |
clearRegisteredFonts() |
static FontProgram |
createFont()
Creates a new standard Helvetica font program file.
|
static FontProgram |
createFont(byte[] fontProgram)
Creates a new font program.
|
static FontProgram |
createFont(byte[] fontProgram,
boolean cached)
Creates a new font program.
|
static FontProgram |
createFont(byte[] ttc,
int ttcIndex,
boolean cached)
Creates a new TrueType font program from ttc (TrueType Collection) file bytes.
|
static FontProgram |
createFont(String fontProgram)
Creates a new font program.
|
static FontProgram |
createFont(String fontProgram,
boolean cached)
Creates a new font program.
|
static FontProgram |
createFont(String ttc,
int ttcIndex,
boolean cached)
Creates a new TrueType font program from ttc (TrueType Collection) file.
|
static FontProgram |
createRegisteredFont(String fontName)
Creates a FontProgram from the font file that has been previously registered.
|
static FontProgram |
createRegisteredFont(String fontName,
int style)
Creates a FontProgram from the font file that has been previously registered.
|
static FontProgram |
createRegisteredFont(String fontName,
int style,
boolean cached)
Creates a FontProgram from the font file that has been previously registered.
|
static FontProgram |
createType1Font(byte[] afm,
byte[] pfb)
Creates a new Type 1 font by the byte contents of the corresponding AFM/PFM and PFB files
|
static FontProgram |
createType1Font(byte[] afm,
byte[] pfb,
boolean cached)
Creates a new Type 1 font by the byte contents of the corresponding AFM/PFM and PFB files
|
static FontProgram |
createType1Font(String metricsPath,
String binaryPath)
Creates a new Type 1 font by the corresponding AFM/PFM and PFB files
|
static FontProgram |
createType1Font(String metricsPath,
String binaryPath,
boolean cached)
Creates a new Type 1 font by the corresponding AFM/PFM and PFB files
|
static Set<String> |
getRegisteredFontFamilies()
Gets a set of registered font names.
|
static Set<String> |
getRegisteredFonts()
Gets a set of registered font names.
|
static boolean |
isRegisteredFont(String fontName)
Checks if a certain font is registered.
|
static void |
registerFont(String path)
Registers a .ttf, .otf, .afm, .pfm, or a .ttc font file.
|
static void |
registerFont(String path,
String alias)
Register a font file and use an alias for the font contained in it.
|
static int |
registerFontDirectory(String dir)
Register all the fonts in a directory.
|
static void |
registerFontFamily(String familyName,
String fullName,
String path)
Register a font by giving explicitly the font family and name.
|
static int |
registerSystemFontDirectories()
Register fonts in some probable directories.
|
public static FontProgram createFont() throws IOException
FontProgram object with Helvetica font descriptionIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createFont(String fontProgram) throws IOException
The fonts are cached and if they already exist they are extracted from the cache, not parsed again.
fontProgram - the name of the font or its location on fileFontProgram. This font program may come from the cacheIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createFont(String fontProgram, boolean cached) throws IOException
The fonts are cached and if they already exist they are extracted from the cache, not parsed again.
fontProgram - the name of the font or its location on filecached - whether to to cache this font program after it has been loadedFontProgram. This font program may come from the cacheIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createFont(byte[] fontProgram) throws IOException
The fonts are cached and if they already exist they are extracted from the cache, not parsed again.
fontProgram - the byte contents of the font programFontProgram. This font program may come from the cacheIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createFont(byte[] fontProgram, boolean cached) throws IOException
The fonts are cached and if they already exist they are extracted from the cache, not parsed again.
fontProgram - the byte contents of the font programcached - whether to to cache this font programFontProgram. This font program may come from the cacheIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createType1Font(byte[] afm, byte[] pfb) throws IOException
afm - the contents of the AFM or PFM metrics filepfb - the contents of the PFB fileFontProgram instanceIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createType1Font(byte[] afm, byte[] pfb, boolean cached) throws IOException
afm - the contents of the AFM or PFM metrics filepfb - the contents of the PFB filecached - specifies whether to cache the created FontProgram or notFontProgram instanceIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createType1Font(String metricsPath, String binaryPath) throws IOException
metricsPath - path to the AFM or PFM metrics filebinaryPath - path to the contents of the PFB fileFontProgram instanceIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createType1Font(String metricsPath, String binaryPath, boolean cached) throws IOException
metricsPath - path to the AFM or PFM metrics filebinaryPath - path to the contents of the PFB filecached - specifies whether to cache the created FontProgram or notFontProgram instanceIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createFont(String ttc, int ttcIndex, boolean cached) throws IOException
ttc - location of TrueType Collection file (*.ttc)ttcIndex - the index of the font file from the collection to be readcached - true if the font comes from the cache or is added to
the cache if new, false if the font is always created newFontProgram instance. This font may come from the cache but only if cached
is true, otherwise it will always be created newIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createFont(byte[] ttc, int ttcIndex, boolean cached) throws IOException
ttc - the content of a TrueType Collection file (*.ttc)ttcIndex - the index of the font file from the collection to be readcached - true if the font comes from the cache or is added to
the cache if new, false if the font is always created newFontProgram instance. This font may come from the cache but only if cached
is true, otherwise it will always be created newIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createRegisteredFont(String fontName, int style, boolean cached) throws IOException
fontName - either a font alias, if the font file has been registered with an alias,
or just a font name otherwisestyle - the style of the font to look for. Possible values are listed in FontStyles.
See FontStyles.BOLD, FontStyles.ITALIC, FontStyles.NORMAL,
FontStyles.BOLDITALIC, FontStyles.UNDEFINEDcached - whether to try to get the font program from cacheFontProgramIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createRegisteredFont(String fontName, int style) throws IOException
fontName - either a font alias, if the font file has been registered with an alias,
or just a font name otherwisestyle - the style of the font to look for. Possible values are listed in FontStyles.
See FontStyles.BOLD, FontStyles.ITALIC, FontStyles.NORMAL,
FontStyles.BOLDITALIC, FontStyles.UNDEFINEDFontProgramIOException - exception is thrown in case an I/O error occurs when reading the filepublic static FontProgram createRegisteredFont(String fontName) throws IOException
fontName - either a font alias, if the font file has been registered with an alias,
or just a font name otherwiseFontProgramIOException - exception is thrown in case an I/O error occurs when reading the file2public static void registerFontFamily(String familyName, String fullName, String path)
familyName - the font familyfullName - the font namepath - the font pathpublic static void registerFont(String path)
path - the path to a font filepublic static void registerFont(String path, String alias)
path - the path to a font filealias - the alias you want to use for the fontpublic static int registerFontDirectory(String dir)
dir - the directorypublic static int registerSystemFontDirectories()
public static Set<String> getRegisteredFonts()
public static Set<String> getRegisteredFontFamilies()
public static boolean isRegisteredFont(String fontName)
fontName - the name of the font that has to be checked.public static void clearRegisteredFonts()
public static void clearRegisteredFontFamilies()
Copyright © 1998–2020 iText Group NV. All rights reserved.