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 PDSimpleFont

    java.lang.Object
      org.pdfbox.pdmodel.font.PDFont
          org.pdfbox.pdmodel.font.PDSimpleFont

All Implemented Interfaces:
  COSObjectable

Direct Known Subclasses:
  PDMMType1Font, PDTrueTypeFont, PDType1Font, PDType3Font

public abstract class PDSimpleFont
extends PDFont

This class contains implementation details of the simple pdf fonts.

Version:
  $Revision: 1.8 $
Author:
  Ben Litchfield (ben@csh.rit.edu)

Field Summary

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

Constructor Summary
`PDSimpleFont()` Constructor.
`PDSimpleFont(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.
`float` | `getAverageFontWidth()` This will get the average font width for all characters.
`PDFontDescriptor` | `getFontDescriptor()` This will get the font descriptor for this font.
`float` | `getFontWidth(byte[] c, int offset, int length)` This will get the font width for a character.
`PDStream` | `getToUnicode()` This will get the ToUnicode stream.
`void` | `setFontDescriptor(PDFontDescriptorDictionary fontDescriptor)` This will set the font descriptor.
`void` | `setToUnicode(PDStream unicode)` This will set the ToUnicode stream.

Methods inherited from class org.pdfbox.pdmodel.font.PDFont
`clearResources, encode, getAFM, getAverageFontWidthFromAFMFile, getBaseFont, getCodeFromArray, getCOSObject, getEncoding, getFirstChar, getFontMatrix, getFontWidthFromAFMFile, getLastChar, getStringWidth, getSubType, getType, getWidths, setBaseFont, setEncoding, setFirstChar, setLastChar, setWidths`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PDSimpleFont

    public PDSimpleFont()

  Constructor.

### PDSimpleFont

    public PDSimpleFont(COSDictionary fontDictionary)

  Constructor.

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

Method Detail

### drawString

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

  Description copied from class: `PDFont`
  This will draw a string on a canvas using the font.

  Specified by:
    `drawString` in class `PDFont`
  Parameters:
    `string` - The string to draw.
    `g` - The graphics to draw onto.
    `fontSize` - The size of the font to draw.
    `xScale` - The x scaling percent.
    `yScale` - The y scaling percent.
    `x` - The x coordinate to draw at.
    `y` - The y coordinate to draw at.
  Throws:
    `IOException` - If there is an error drawing the specific string.
  See Also:
    `PDFont.drawString( String, Graphics, float, float, float, float, float )`

### getFontWidth

    public float getFontWidth(byte[] c,
                              int offset,
                              int length)
                       throws IOException

  This will get the font width for a character.

  Specified by:
    `getFontWidth` in class `PDFont`
  Parameters:
    `c` - The character code to get the width for.
    `offset` - The offset into the array.
    `length` - The length of the data.
  Returns:
    The width is in 1000 unit of text space, ie 333 or 777
  Throws:
    `IOException` - If an error occurs while parsing.

### getAverageFontWidth

    public float getAverageFontWidth()
                              throws IOException

  This will get the average font width for all characters.

  Specified by:
    `getAverageFontWidth` in class `PDFont`
  Returns:
    The width is in 1000 unit of text space, ie 333 or 777
  Throws:
    `IOException` - If an error occurs while parsing.

### getFontDescriptor

    public PDFontDescriptor getFontDescriptor()
                                       throws IOException

  This will get the font descriptor for this font.

  Returns:
    The font descriptor for this font.
  Throws:
    `IOException` - If there is an error parsing an AFM file, or unable to create a PDFontDescriptor object.

### setFontDescriptor

    public void setFontDescriptor(PDFontDescriptorDictionary fontDescriptor)

  This will set the font descriptor.

  Parameters:
    `fontDescriptor` - The font descriptor.

### getToUnicode

    public PDStream getToUnicode()
                          throws IOException

  This will get the ToUnicode stream.

  Returns:
    The ToUnicode stream.
  Throws:
    `IOException` - If there is an error getting the stream.

### setToUnicode

    public void setToUnicode(PDStream unicode)

  This will set the ToUnicode stream.

  Parameters:
    `unicode` - The unicode stream.

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