Class PDType0Font

All Implemented Interfaces:
COSObjectable

public class PDType0Font extends PDSimpleFont
This is implementation of the Type0 Font. See PDFBOX-605 for the related improvement issue.
Version:
$Revision: 1.9 $
Author:
Ben Litchfield
  • Constructor Details

    • PDType0Font

      public PDType0Font()
      Constructor.
    • PDType0Font

      public PDType0Font(COSDictionary fontDictionary)
      Constructor.
      Parameters:
      fontDictionary - The font dictionary according to the PDF specification.
  • Method Details

    • getawtFont

      public Font getawtFont() throws IOException
      Looks up, creates, returns the AWT Font.
      Overrides:
      getawtFont in class PDSimpleFont
      Returns:
      returns the awt font to bes used for rendering
      Throws:
      IOException - if something went wrong.
    • getFontBoundingBox

      public PDRectangle getFontBoundingBox() throws IOException
      This will get the fonts bounding box.
      Overrides:
      getFontBoundingBox in class PDSimpleFont
      Returns:
      The fonts bounding box.
      Throws:
      IOException - If there is an error getting the bounding box.
    • getFontWidth

      public float getFontWidth(byte[] c, int offset, int length) throws IOException
      This will get the font width for a character.
      Overrides:
      getFontWidth in class PDSimpleFont
      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.
    • getFontHeight

      public float getFontHeight(byte[] c, int offset, int length) throws IOException
      This will get the font height for a character.
      Overrides:
      getFontHeight in class PDSimpleFont
      Parameters:
      c - The character code to get the height 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.
      Overrides:
      getAverageFontWidth in class PDSimpleFont
      Returns:
      The width is in 1000 unit of text space, ie 333 or 777
      Throws:
      IOException - If an error occurs while parsing.
    • getFontWidth

      public float getFontWidth(int charCode)
      Determines the width of the given character.
      Overrides:
      getFontWidth in class PDFont
      Parameters:
      charCode - the code of the given character
      Returns:
      the width of the character
    • encode

      public String encode(byte[] c, int offset, int length) throws IOException
      Description copied from class: PDFont
      This will perform the encoding of a character if needed.
      Overrides:
      encode in class PDFont
      Parameters:
      c - The character to encode.
      offset - The offset into the array to get the data
      length - The number of bytes to read.
      Returns:
      The value of the encoded character.
      Throws:
      IOException - If there is an error during the encoding.
    • getDescendantFont

      public PDFont getDescendantFont()
      Provides the descendant font.
      Returns:
      the descendant font.
    • clear

      public void clear()
      Description copied from class: PDFont
      Calling this will release all cached information.
      Overrides:
      clear in class PDFont