Class OpenTypeFontTableReader

java.lang.Object
com.itextpdf.io.font.otf.OpenTypeFontTableReader
Direct Known Subclasses:
GlyphPositioningTableReader, GlyphSubstitutionTableReader

public abstract class OpenTypeFontTableReader extends Object
Reads the common structures of an OpenType layout table.
  • Field Details

  • Constructor Details

    • OpenTypeFontTableReader

      protected OpenTypeFontTableReader (RandomAccessFileOrArray rf, int tableLocation, OpenTypeGdefTableReader gdef, Map<Integer,Glyph> indexGlyphMap, int unitsPerEm)
      Creates a new reader.
      Parameters:
      rf - the source
      tableLocation - the table location
      gdef - the GDEF reader
      indexGlyphMap - the index glyph map
      unitsPerEm - the units per em
  • Method Details

    • getGlyph

      public Glyph getGlyph (int index)
      Returns the glyph by index.
      Parameters:
      index - the index
      Returns:
      the requested result
    • getLookupTable

      public OpenTableLookup getLookupTable (int idx)
      Returns the lookup table.
      Parameters:
      idx - the idx
      Returns:
      the requested result
    • getScriptRecords

      public List<ScriptRecord> getScriptRecords()
      Returns the script records.
      Returns:
      the requested result
    • getFeatureRecords

      public List<FeatureRecord> getFeatureRecords()
      Returns the feature records.
      Returns:
      the requested result
    • getFeatures

      public List<FeatureRecord> getFeatures (String[] scripts, String language)
      Returns the features represented by FeatureRecord list.
      Parameters:
      scripts - the scripts
      language - the language
      Returns:
      the requested result
    • getSpecificFeatures

      public List<FeatureRecord> getSpecificFeatures (List<FeatureRecord> features, String[] specific)
      Returns the specific features represented by FeatureRecord list.
      Parameters:
      features - FeatureRecord list
      specific - specific tags of the feature record
      Returns:
      the requested result
    • getRequiredFeature

      public FeatureRecord getRequiredFeature (String[] scripts, String language)
      Returns the required feature represented by FeatureRecord.
      Parameters:
      scripts - the scripts
      language - the language
      Returns:
      the requested result
    • getLookups

      public List<OpenTableLookup> getLookups (FeatureRecord[] features)
      Returns the lookups.
      Parameters:
      features - the features
      Returns:
      the requested result
    • getLookups

      public List<OpenTableLookup> getLookups (FeatureRecord feature)
      Returns the lookups.
      Parameters:
      feature - the feature
      Returns:
      the requested result
    • isSkip

      public boolean isSkip (int glyph, int lookupFlag)
      Checks if lookup must ignore the specified glyph when processing glyph sequences.
      Parameters:
      glyph - glyph to check
      lookupFlag - specifies processing options, e.g. whether to skip base glyphs, marks or ligatures during glyph substitution or positioning. See Lookup table
      Returns:
      true if the specified glyph should be skipped, false otherwise
    • getGlyphClass

      public int getGlyphClass (int glyphCode)
      Returns the glyph class.
      Parameters:
      glyphCode - the glyph code
      Returns:
      the requested result
    • getUnitsPerEm

      public int getUnitsPerEm()
      Returns the units per em.
      Returns:
      the requested result
    • getLanguageRecord

      public LanguageRecord getLanguageRecord (String otfScriptTag)
      Returns the language record.
      Parameters:
      otfScriptTag - the otf script tag
      Returns:
      the requested result
    • getLanguageRecord

      public LanguageRecord getLanguageRecord (String otfScriptTag, String langTag)
      Returns the language record.
      Parameters:
      otfScriptTag - the otf script tag
      langTag - the lang tag
      Returns:
      the requested result
    • readLookupTable

      protected abstract OpenTableLookup readLookupTable (int lookupType, int lookupFlag, int[] subTableLocations) throws IOException
      Reads the lookup table from OpenType data.
      Parameters:
      lookupType - the lookup type
      lookupFlag - specifies processing options, e.g. whether to skip base glyphs, marks or ligatures during glyph substitution or positioning. See Lookup table
      subTableLocations - the sub table locations
      Returns:
      the requested result
      Throws:
      IOException - if the OpenType data cannot be read
    • readClassDefinition

      protected final OtfClass readClassDefinition (int classLocation)
      Reads the class definition from OpenType data.
      Parameters:
      classLocation - the class location
      Returns:
      the requested result
    • readUShortArray

      protected final int[] readUShortArray (int size, int location) throws IOException
      Reads the ushort array from OpenType data.
      Parameters:
      size - the size
      location - the location
      Returns:
      the requested result
      Throws:
      IOException - if the OpenType data cannot be read
    • readUShortArray

      protected final int[] readUShortArray (int size) throws IOException
      Reads the ushort array from OpenType data.
      Parameters:
      size - the size
      Returns:
      the requested result
      Throws:
      IOException - if the OpenType data cannot be read
    • readCoverages

      protected void readCoverages (int[] locations, List<Set<Integer>> coverage) throws IOException
      Reads the coverages from OpenType data.
      Parameters:
      locations - the locations
      coverage - the coverage to retain the result
      Throws:
      IOException - if the OpenType data cannot be read
    • readCoverageFormat

      protected final List<Integer> readCoverageFormat (int coverageLocation) throws IOException
      Reads the coverage format from OpenType data.
      Parameters:
      coverageLocation - the coverage location
      Returns:
      the requested result
      Throws:
      IOException - if the OpenType data cannot be read
    • readSubstLookupRecords

      protected SubstLookupRecord[] readSubstLookupRecords (int substCount) throws IOException
      Reads the substitution lookup records from OpenType data.
      Parameters:
      substCount - the substitution lookups count to read
      Returns:
      the requested result
      Throws:
      IOException - if the OpenType data cannot be read
    • readPosLookupRecords

      protected PosLookupRecord[] readPosLookupRecords (int substCount) throws IOException
      Reads the positioning lookup records from OpenType data.
      Parameters:
      substCount - the positioning lookups count to read
      Returns:
      the requested result
      Throws:
      IOException - if the OpenType data cannot be read
    • readTagAndLocations

      protected TagAndLocation[] readTagAndLocations (int baseLocation) throws IOException
      Reads the tag and locations from OpenType data.
      Parameters:
      baseLocation - the base location
      Returns:
      the requested result
      Throws:
      IOException - if the OpenType data cannot be read