public final class FontProgramFactory extends Object
Modifier and Type | Method and Description |
---|---|
static void |
clearRegisteredFontFamilies() |
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 description
IOException
public 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 file
FontProgram
. This font program may come from the cache
IOException
public 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 file
cached
- whether to to cache this font program after it has been loaded
FontProgram
. This font program may come from the cache
IOException
public 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 program
FontProgram
. This font program may come from the cache
IOException
public 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 program
cached
- whether to to cache this font program
FontProgram
. This font program may come from the cache
IOException
public static FontProgram createType1Font(byte[] afm, byte[] pfb) throws IOException
afm
- the contents of the AFM or PFM metrics file
pfb
- the contents of the PFB file
FontProgram
instance
IOException
public static FontProgram createType1Font(byte[] afm, byte[] pfb, boolean cached) throws IOException
afm
- the contents of the AFM or PFM metrics file
pfb
- the contents of the PFB file
cached
- specifies whether to cache the created FontProgram
or not
FontProgram
instance
IOException
public static FontProgram createType1Font(String metricsPath, String binaryPath) throws IOException
metricsPath
- path to the AFM or PFM metrics file
binaryPath
- path to the contents of the PFB file
FontProgram
instance
IOException
public static FontProgram createType1Font(String metricsPath, String binaryPath, boolean cached) throws IOException
metricsPath
- path to the AFM or PFM metrics file
binaryPath
- path to the contents of the PFB file
cached
- specifies whether to cache the created FontProgram
or not
FontProgram
instance
IOException
public 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 read
cached
- true if the font comes from the cache or is added to the cache if new, false if the font is always created new
FontProgram
instance. This font may come from the cache but only if cached is true, otherwise it will always be created new
IOException
public 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 read
cached
- true if the font comes from the cache or is added to the cache if new, false if the font is always created new
FontProgram
instance. This font may come from the cache but only if cached is true, otherwise it will always be created new
IOException
public 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 otherwise
style
- the style of the font to look for. Possible values are listed in FontStyles
. See FontStyles.BOLD
, FontStyles.ITALIC
, FontStyles.NORMAL
, FontStyles.BOLDITALIC
, FontStyles.UNDEFINED
cached
- whether to try to get the font program from cache
FontProgram
IOException
public 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 otherwise
style
- the style of the font to look for. Possible values are listed in FontStyles
. See FontStyles.BOLD
, FontStyles.ITALIC
, FontStyles.NORMAL
, FontStyles.BOLDITALIC
, FontStyles.UNDEFINED
FontProgram
IOException
public 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 otherwise
FontProgram
IOException
public static void registerFontFamily(String familyName, String fullName, String path)
familyName
- the font family
fullName
- the font name
path
- the font path
public static void registerFont(String path)
path
- the path to a font file
public static void registerFont(String path, String alias)
path
- the path to a font file
alias
- the alias you want to use for the font
public static int registerFontDirectory(String dir)
dir
- the directory
public 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–2018 iText Group NV. All rights reserved.