Class TTFFont

Direct Known Subclasses:
CIDFontType2

public class TTFFont extends OutlineFont
A true-type font
  • Field Details

    • font

      private TrueTypeFont font
      the truetype font itself
    • unitsPerEm

      private float unitsPerEm
      the number of units per em in the font
  • Constructor Details

    • TTFFont

      public TTFFont(String baseFont, PDFObject fontObj, PDFFontDescriptor descriptor) throws IOException
      create a new TrueTypeFont 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.
      Throws:
      IOException
  • Method Details

    • getOutline

      protected GeneralPath getOutline(char src, float width)
      Get the outline of a character given the character code
      Specified by:
      getOutline in class OutlineFont
      Parameters:
      src - the character code of the desired glyph
      Returns:
      the glyph outline
    • getOutlineFromCMaps

      protected GeneralPath getOutlineFromCMaps(char val, float width)
      lookup the outline using the CMAPs, as specified in 32000-1:2008, 9.6.6.4, when an Encoding is specified.
      Parameters:
      val -
      width -
      Returns:
      GeneralPath
    • getOutline

      protected GeneralPath getOutline(String name, float width)
      Get the outline of a character given the character name
      Specified by:
      getOutline in class OutlineFont
      Parameters:
      name - the name of the desired glyph
      Returns:
      the glyph outline, or null if unavailable
    • getOutline

      protected GeneralPath getOutline(int glyphId, float width)
      Get the outline of a character given the glyph id
    • renderSimpleGlyph

      protected GeneralPath renderSimpleGlyph(GlyfSimple g)
      Render a simple glyf
    • renderCompoundGlyph

      protected GeneralPath renderCompoundGlyph(GlyfTable glyf, GlyfCompound g)
      Render a compound glyf
    • addOnCurvePoint

      private void addOnCurvePoint(TTFFont.PointRec rec, TTFFont.RenderState rs)
      add a point on the curve
    • addOffCurvePoint

      private void addOffCurvePoint(TTFFont.PointRec rec, TTFFont.RenderState rs)
      add a point off the curve