public final class FontProgramFactory extends Object
| Modifier and Type | Method and Description |
|---|---|
static FontProgram |
createFont()
Creates a new font.
|
static FontProgram |
createFont(byte[] fontProgram)
Creates a new font.
|
static FontProgram |
createFont(byte[] ttc,
int ttcIndex,
boolean cached) |
static FontProgram |
createFont(String fontProgram)
Creates a new font.
|
static FontProgram |
createFont(String fontProgram,
boolean cached)
Creates a new font.
|
static FontProgram |
createFont(String name,
byte[] font,
boolean cached)
Creates a new font.
|
static FontProgram |
createFont(String ttc,
int ttcIndex,
boolean cached)
Creates a new True Type font from ttc file,
The fonts may or may not be cached depending on the flag
cached. |
static FontProgram |
createRegisteredFont(String fontName) |
static FontProgram |
createRegisteredFont(String fontName,
int style) |
static FontProgram |
createRegisteredFont(String fontName,
int style,
boolean cached) |
static FontProgram |
createType1Font(byte[] afm,
byte[] pfb) |
static FontProgram |
createType1Font(String name,
byte[] afm,
byte[] pfb,
boolean cached)
Creates a new font.
|
static FontProgram |
createType1Font(String metricsPath,
String binaryPath) |
static FontProgram |
createType1Font(String metricsPath,
String binaryPath,
boolean cached) |
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)
Register a ttf- or a ttc-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
IOExceptionpublic static FontProgram createFont(String fontProgram) throws IOException
"# simple 32 0020 0041 0042 0454"Example for a "full" encoding for a Type1 Tex font:
"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"This method calls:
createFont(name, null, true);
fontProgram - the name of the font or its location on fileIOExceptionpublic static FontProgram createFont(String fontProgram, boolean cached) throws IOException
"# simple 32 0020 0041 0042 0454"Example for a "full" encoding for a Type1 Tex font:
"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"This method calls:
createFont(name, encoding, embedded, true, null, null);
fontProgram - the name of the font or its location on filecached - true if the font comes from the cache or is added to
the cache if new, false if the font is always created newIOExceptionpublic static FontProgram createFont(byte[] fontProgram) throws IOException
"# simple 32 0020 0041 0042 0454"Example for a "full" encoding for a Type1 Tex font:
"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"
fontProgram - the true type font or the afm in a byte array
an exception if the font is not recognized. Note that even if true an exception may be thrown in some circumstances.
This parameter is useful for FontProgramFactory that may have to check many invalid font names before finding the right oneIOExceptionpublic static FontProgram createFont(String name, byte[] font, boolean cached) throws IOException
cached.
If the byte arrays are present the font will be
read from them instead of the name. A name is still required to identify
the font type.
Besides the common encodings described by name, custom encodings
can also be made. These encodings will only work for the single byte fonts
Type1 and TrueType. The encoding string starts with a '#'
followed by "simple" or "full". If "simple" there is a decimal for the first character position and then a list
of hex values representing the Unicode codes that compose that encoding."# simple 32 0020 0041 0042 0454"Example for a "full" encoding for a Type1 Tex font:
"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"
name - the name of the font or its location on filefont - the true type font or the afm in a byte arraycached - true if the font comes from the cache or is added to
the cache if new, false if the font is always created newIOExceptionpublic static FontProgram createType1Font(String name, byte[] afm, byte[] pfb, boolean cached) throws IOException
cached.
If the byte arrays are present the font will be
read from them instead of the name. A name is still required to identify
the font type.
Besides the common encodings described by name, custom encodings
can also be made. These encodings will only work for the single byte fonts
Type1 and TrueType. The encoding string starts with a '#'
followed by "simple" or "full". If "simple" there is a decimal for the first character position and then a list
of hex values representing the Unicode codes that compose that encoding."# simple 32 0020 0041 0042 0454"Example for a "full" encoding for a Type1 Tex font:
"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"
name - the name of the font or its location on filecached - true if the font comes from the cache or is added to
the cache if new, false if the font is always created newafm - the afm or pfm metrics file in a byte arraypfb - the pfb in a byte arrayIOExceptionpublic static FontProgram createType1Font(byte[] afm, byte[] pfb) throws IOException
IOExceptionpublic static FontProgram createType1Font(String metricsPath, String binaryPath, boolean cached) throws IOException
IOExceptionpublic static FontProgram createType1Font(String metricsPath, String binaryPath) throws IOException
IOExceptionpublic static FontProgram createFont(String ttc, int ttcIndex, boolean cached) throws IOException
cached.
If the byte arrays are present the font will be
read from them instead of the name. A name is still required to identify
the font type.
Besides the common encodings described by name, custom encodings
can also be made. These encodings will only work for the single byte fonts
Type1 and TrueType. The encoding string starts with a '#'
followed by "simple" or "full". If "simple" there is a decimal for the first character position and then a list
of hex values representing the Unicode codes that compose that encoding."# simple 32 0020 0041 0042 0454"Example for a "full" encoding for a Type1 Tex font:
"# full 'A' nottriangeqlleft 0041 'B' dividemultiply 0042 32 space 0020"
ttc - location of true type collection file (*.ttc)ttcIndex - the encoding to be applied to 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 newIOExceptionpublic static FontProgram createFont(byte[] ttc, int ttcIndex, boolean cached) throws IOException
IOExceptionpublic static FontProgram createRegisteredFont(String fontName, int style, boolean cached) throws IOException
IOExceptionpublic static FontProgram createRegisteredFont(String fontName, int style) throws IOException
IOExceptionpublic static FontProgram createRegisteredFont(String fontName) throws IOException
IOExceptionpublic 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 ttf- or ttc-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.Copyright © 1998–2016 iText Group NV. All rights reserved.