public class PDTrueTypeFont extends PDSimpleFont
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
UNKNOWN_FONT
This is the key to a property in the PDFBox_External_Fonts.properties
file to load a Font when a mapping does not exist for the current font.
|
cmap, cmapObjects, font, fontMatrix, resourceRootCMAP, toUnicodeCmap| Constructor and Description |
|---|
PDTrueTypeFont()
Constructor.
|
PDTrueTypeFont(COSDictionary fontDictionary)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Calling this will release all cached information.
|
java.awt.Font |
getawtFont()
Looks up, creates, returns the AWT Font.
|
float |
getFontWidth(int charCode)
Determines the width of the given character.
|
org.apache.fontbox.ttf.TrueTypeFont |
getTTFFont()
Return the TTF font as TrueTypeFont.
|
static PDTrueTypeFont |
loadTTF(PDDocument doc,
java.io.File file)
This will load a TTF to be embedded into a document.
|
static PDTrueTypeFont |
loadTTF(PDDocument doc,
java.io.InputStream stream)
This will load a TTF to be embedded into a document.
|
static PDTrueTypeFont |
loadTTF(PDDocument doc,
java.io.InputStream stream,
Encoding enc)
This will load a TTF to be embedded into a document.
|
static PDTrueTypeFont |
loadTTF(PDDocument doc,
java.lang.String file)
This will load a TTF font from a font file.
|
static PDTrueTypeFont |
loadTTF(PDStream fontStream,
Encoding enc)
This will load a TTF to be embedded into a document.
|
determineEncoding, drawString, getAverageFontWidth, getFontBoundingBox, getFontHeight, getFontWidth, getSpaceWidth, getToUnicode, isFontSubstituted, setIsFontSubstituted, setToUnicode, writeFontclearResources, cmapEncoding, drawString, encode, encodeToCID, equals, getAFM, getAverageFontWidthFromAFMFile, getBaseFont, getCodeFromArray, getCOSObject, getEncoding, getFirstChar, getFontDescriptor, getFontEncoding, getFontMatrix, getFontWidthFromAFMFile, getLastChar, getStringFromArray, getStringWidth, getSubType, getToUnicodeCMap, getType, getWidths, hashCode, hasToUnicode, isSymbolicFont, isType0Font, isType1Font, isType3Font, parseCmap, setBaseFont, setEncoding, setFirstChar, setFontDescriptor, setFontEncoding, setHasToUnicode, setLastChar, setWidthspublic static final java.lang.String UNKNOWN_FONT
public PDTrueTypeFont()
public PDTrueTypeFont(COSDictionary fontDictionary) throws java.io.IOException
fontDictionary - The font dictionary according to the PDF specification.java.io.IOException - exception if something went wrong when loading the font.public static PDTrueTypeFont loadTTF(PDDocument doc, java.lang.String file) throws java.io.IOException
doc - The PDF document that will hold the embedded font.file - The file on the filesystem that holds the font file.java.io.IOException - If there is an error loading the file data.public static PDTrueTypeFont loadTTF(PDDocument doc, java.io.File file) throws java.io.IOException
doc - The PDF document that will hold the embedded font.file - a ttf file.java.io.IOException - If there is an error loading the data.public static PDTrueTypeFont loadTTF(PDDocument doc, java.io.InputStream stream) throws java.io.IOException
doc - The PDF document that will hold the embedded font.stream - a ttf input stream.java.io.IOException - If there is an error loading the data.public static PDTrueTypeFont loadTTF(PDDocument doc, java.io.InputStream stream, Encoding enc) throws java.io.IOException
doc - The PDF document that will hold the embedded font.stream - a ttf input stream.enc - The font encoding.java.io.IOException - If there is an error loading the data.public static PDTrueTypeFont loadTTF(PDStream fontStream, Encoding enc) throws java.io.IOException
fontStream - a ttf input stream.enc - The font encoding.java.io.IOException - If there is an error loading the data.public java.awt.Font getawtFont()
throws java.io.IOException
getawtFont in class PDSimpleFontjava.io.IOException - if something went wrong.public org.apache.fontbox.ttf.TrueTypeFont getTTFFont()
throws java.io.IOException
java.io.IOException - If there is an error loading the datapublic void clear()
PDFontpublic float getFontWidth(int charCode)
PDFontgetFontWidth in class PDFontcharCode - the code of the given character