Class BaseTrueTypeProgram

java.lang.Object
org.verapdf.pd.font.truetype.BaseTrueTypeProgram
All Implemented Interfaces:
FontProgram
Direct Known Subclasses:
CIDFontType2Program, TrueTypeFontProgram

public abstract class BaseTrueTypeProgram extends Object implements FontProgram
Base class for TrueTypeFontProgram and CIDFontType2Program.
Author:
Sergey Shemyakov
  • Field Details

  • Constructor Details

    • BaseTrueTypeProgram

      public BaseTrueTypeProgram(ASInputStream stream) throws IOException
      Constructor from stream containing font data, and encoding details.
      Parameters:
      stream - is stream containing font data.
      Throws:
      IOException - if creation of @{link SeekableStream} fails.
  • Method Details

    • parseFont

      public void parseFont() throws IOException
      Parses True Type font from given stream and extracts all the data needed.
      Specified by:
      parseFont in interface FontProgram
      Throws:
      IOException - if stream-reading error occurs.
    • getNrOfCMaps

      public int getNrOfCMaps()
      Returns:
      array, containing platform ID and encoding ID for each cmap in this True Type font.
    • getNGlyphs

      public int getNGlyphs()
      Returns:
      number of glyphs in this font.
    • isCmapPresent

      public boolean isCmapPresent(int platformID, int encodingID)
      Returns true if cmap table with given platform ID and encoding ID is present in the font.
      Parameters:
      platformID - is platform ID of requested cmap.
      encodingID - is encoding ID of requested cmap.
      Returns:
      true if requested cmap is present.
    • getWidthWithCheck

      protected float getWidthWithCheck(int gid)
    • isAttemptedParsing

      public boolean isAttemptedParsing()
      Specified by:
      isAttemptedParsing in interface FontProgram
      Returns:
      true if font parsing has been attempted.
    • isSuccessfulParsing

      public boolean isSuccessfulParsing()
      Specified by:
      isSuccessfulParsing in interface FontProgram
      Returns:
      true if font was successfully parsed.
    • getFontProgramResource

      public ASFileStreamCloser getFontProgramResource()
      Specified by:
      getFontProgramResource in interface FontProgram
      Returns:
      file stream closer that handles the closing of font program stream or null if stream is memory stream.
    • getWeight

      public String getWeight()
      Specified by:
      getWeight in interface FontProgram
    • getAscent

      public Double getAscent()
      Specified by:
      getAscent in interface FontProgram
    • getDescent

      public Double getDescent()
      Specified by:
      getDescent in interface FontProgram