Class NativeFont


public class NativeFont extends OutlineFont
a font object derived from a true type font.

Author Mike Wessler

  • Field Details

    • controlChars

      protected static final char[] controlChars
      Control characters to filter out of the underlying font
    • mapIDs

      protected static final short[] mapIDs
      the ids of our favorite CMaps
  • Constructor Details

    • NativeFont

      public NativeFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) throws IOException
      create a new NativeFont object based on a description of the font from the PDF file. If the description happens to contain an in-line true-type font file (under key "FontFile2"), use the true type font. Otherwise, parse the description for key information and use that to generate an appropriate font.
      Parameters:
      baseFont - a String object.
      fontObj - a PDFObject object.
      descriptor - a PDFFontDescriptor object.
      Throws:
      IOException - if any.
  • Method Details

    • getOutline

      protected GeneralPath getOutline(String name, float width)
      Get a glyph outline by name

      Get a glyph outline by name

      Specified by:
      getOutline in class OutlineFont
      Parameters:
      name - the name of the desired glyph
      width - a float.
      Returns:
      the glyph outline, or null if unavailable
    • getOutline

      protected GeneralPath getOutline(char src, float width)
      Get a glyph outline by character code

      Note this method must always return an outline

      Get a glyph outline by character code

      Note this method must always return an outline

      Specified by:
      getOutline in class OutlineFont
      Parameters:
      src - the character code of the desired glyph
      width - a float.
      Returns:
      the glyph outline
    • setFont

      protected void setFont(Font f)
      Set the font
      Parameters:
      f - the font to use
    • setFont

      protected void setFont(byte[] fontdata) throws FontFormatException, IOException
      Set the font
      Parameters:
      fontdata - the font data as a byte array
      Throws:
      FontFormatException - if any.
      IOException - if any.