Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.pdfbox.pdmodel.font
Class PDTrueTypeFont

    java.lang.Object
      org.pdfbox.pdmodel.font.PDFont
          org.pdfbox.pdmodel.font.PDSimpleFont
              org.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 Resources/PDFBox_External_Fonts.properties file to load a Font when a mapping does not exist for the current font.

Fields inherited from class org.pdfbox.pdmodel.font.PDFont
`font`

Constructor Summary
`PDTrueTypeFont()` Constructor.
`PDTrueTypeFont(COSDictionary fontDictionary)` Constructor.

Method Summary
`void` | `drawString(String string, Graphics g, float fontSize, float xScale, float yScale, float x, float y)` This will draw a string on a canvas using the font.
`static PDTrueTypeFont` | `loadTTF(PDDocument doc, File file)` This will load a TTF to be embedding 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.pdfbox.pdmodel.font.PDSimpleFont
`getAverageFontWidth, getFontBoundingBox, getFontDescriptor, getFontHeight, getFontWidth, getToUnicode, setFontDescriptor, setToUnicode`

Methods inherited from class org.pdfbox.pdmodel.font.PDFont
`clearResources, encode, equals, getAFM, getAverageFontWidthFromAFMFile, getBaseFont, getCodeFromArray, getCOSObject, getEncoding, getFirstChar, getFontMatrix, getFontWidthFromAFMFile, getLastChar, getStringWidth, getSubType, getType, getWidths, hashCode, setBaseFont, setEncoding, setFirstChar, 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 Resources/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)

  Constructor.

Parameters:
  `fontDictionary` - The font dictionary according to the PDF specification.

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 embedding into a document.

  Parameters:
    `doc` - The PDF document that will hold the embedded font.
    `file` - A TTF file stream.
  Returns:
    A PDF TTF.
  Throws:
    `IOException` - If there is an error loading the data.

### drawString

    public void drawString(String string,
                           Graphics g,
                           float fontSize,
                           float xScale,
                           float yScale,
                           float x,
                           float y)
                    throws IOException

  This will draw a string on a canvas using the font.

  Overrides:
    `drawString` in class `PDSimpleFont`
  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD