org.apache.pdfbox.pdmodel.font
Class PDTrueTypeFont

java.lang.Object
  extended by org.apache.pdfbox.pdmodel.font.PDFont
      extended by org.apache.pdfbox.pdmodel.font.PDSimpleFont
          extended by org.apache.pdfbox.pdmodel.font.PDTrueTypeFont
All Implemented Interfaces:
COSObjectable

public class PDTrueTypeFont
extends PDSimpleFont

This is the TrueType implementation of fonts.

Version:
$Revision: 1.17 $
Author:
Ben Litchfield

Field Summary
static 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.
 
Fields inherited from class org.apache.pdfbox.pdmodel.font.PDFont
cmap, cmapObjects, font, fontMatrix, resourceRootCMAP
 
Constructor Summary
PDTrueTypeFont()
          Constructor.
PDTrueTypeFont(COSDictionary fontDictionary)
          Constructor.
 
Method Summary
 Font getawtFont()
          Looks up, creates, returns the AWT Font.
static PDTrueTypeFont loadTTF(PDDocument doc, File file)
          This will load a TTF to be embedded into a document.
static PDTrueTypeFont loadTTF(PDDocument doc, InputStream stream)
          This will load a TTF to be embedded into a document.
static PDTrueTypeFont loadTTF(PDDocument doc, String file)
          This will load a TTF font from a font file.
 
Methods inherited from class org.apache.pdfbox.pdmodel.font.PDSimpleFont
determineEncoding, drawString, getAverageFontWidth, getFontBoundingBox, getFontHeight, getFontWidth, getToUnicode, setToUnicode, writeFont
 
Methods inherited from class org.apache.pdfbox.pdmodel.font.PDFont
clearResources, cmapEncoding, createString, encode, equals, getAFM, getAverageFontWidthFromAFMFile, getBaseFont, getCodeFromArray, getCOSObject, getEncoding, getFirstChar, getFontDescriptor, getFontEncoding, getFontMatrix, getFontWidth, getFontWidthFromAFMFile, getLastChar, getStringWidth, getSubType, getType, getWidths, hashCode, hasToUnicode, isType1Font, parseCmap, setBaseFont, setEncoding, setFirstChar, setFontDescriptor, setFontEncoding, setHasToUnicode, setLastChar, setWidths
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_FONT

public static final 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.

See Also:
Constant Field Values
Constructor Detail

PDTrueTypeFont

public PDTrueTypeFont()
Constructor.


PDTrueTypeFont

public PDTrueTypeFont(COSDictionary fontDictionary)
               throws IOException
Constructor.

Parameters:
fontDictionary - The font dictionary according to the PDF specification.
Throws:
IOException
Method Detail

loadTTF

public static PDTrueTypeFont loadTTF(PDDocument doc,
                                     String file)
                              throws IOException
This will load a TTF font from a font file.

Parameters:
doc - The PDF document that will hold the embedded font.
file - The file on the filesystem that holds the font file.
Returns:
A true type font.
Throws:
IOException - If there is an error loading the file data.

loadTTF

public static PDTrueTypeFont loadTTF(PDDocument doc,
                                     File file)
                              throws IOException
This will load a TTF to be embedded into a document.

Parameters:
doc - The PDF document that will hold the embedded font.
file - a ttf file.
Returns:
a PDTrueTypeFont instance.
Throws:
IOException - If there is an error loading the data.

loadTTF

public static PDTrueTypeFont loadTTF(PDDocument doc,
                                     InputStream stream)
                              throws IOException
This will load a TTF to be embedded into a document.

Parameters:
doc - The PDF document that will hold the embedded font.
stream - a ttf input stream.
Returns:
a PDTrueTypeFont instance.
Throws:
IOException - If there is an error loading the data.

getawtFont

public Font getawtFont()
                throws IOException
Looks up, creates, returns the AWT Font.

Overrides:
getawtFont in class PDSimpleFont
Throws:
IOException


Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.