Package com.itextpdf.io.font.otf
Class OpenTypeFontTableReader
java.lang.Object
com.itextpdf.io.font.otf.OpenTypeFontTableReader
- Direct Known Subclasses:
-
GlyphPositioningTableReader,GlyphSubstitutionTableReader
Reads the common structures of an OpenType layout table.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OpenTypeFeatureStores features type.protected List<OpenTableLookup>Stores lookup list.protected final RandomAccessFileOrArrayprotected OpenTypeScriptStores scripts type.protected final intStores table location. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOpenTypeFontTableReader(RandomAccessFileOrArray rf, int tableLocation, OpenTypeGdefTableReader gdef, Map<Integer, Glyph> indexGlyphMap, int unitsPerEm) Creates a new reader. -
Method Summary
Modifier and TypeMethodDescriptionReturns the feature records.getFeatures(String[] scripts, String language) Returns the features represented byFeatureRecordlist.getGlyph(int index) Returns the glyph by index.intgetGlyphClass(int glyphCode) Returns the glyph class.getLanguageRecord(String otfScriptTag) Returns the language record.getLanguageRecord(String otfScriptTag, String langTag) Returns the language record.getLookups(FeatureRecord feature) Returns the lookups.getLookups(FeatureRecord[] features) Returns the lookups.getLookupTable(int idx) Returns the lookup table.getRequiredFeature(String[] scripts, String language) Returns the required feature represented byFeatureRecord.Returns the script records.getSpecificFeatures(List<FeatureRecord> features, String[] specific) Returns the specific features represented byFeatureRecordlist.intReturns the units per em.booleanisSkip(int glyph, int lookupFlag) Checks if lookup must ignore the specified glyph when processing glyph sequences.protected final OtfClassreadClassDefinition(int classLocation) Reads the class definition from OpenType data.readCoverageFormat(int coverageLocation) Reads the coverage format from OpenType data.protected voidreadCoverages(int[] locations, List<Set<Integer>> coverage) Reads the coverages from OpenType data.protected abstract OpenTableLookupreadLookupTable(int lookupType, int lookupFlag, int[] subTableLocations) Reads the lookup table from OpenType data.protected PosLookupRecord[]readPosLookupRecords(int substCount) Reads the positioning lookup records from OpenType data.protected SubstLookupRecord[]readSubstLookupRecords(int substCount) Reads the substitution lookup records from OpenType data.protected TagAndLocation[]readTagAndLocations(int baseLocation) Reads the tag and locations from OpenType data.protected final int[]readUShortArray(int size) Reads the ushort array from OpenType data.protected final int[]readUShortArray(int size, int location) Reads the ushort array from OpenType data.
-
Field Details
-
rf
-
tableLocation
protected final int tableLocationStores table location. -
lookupList
Stores lookup list. -
scriptsType
Stores scripts type. -
featuresType
Stores features type.
-
-
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
Returns the glyph by index.- Parameters:
-
index- the index - Returns:
- the requested result
-
getLookupTable
Returns the lookup table.- Parameters:
-
idx- the idx - Returns:
- the requested result
-
getScriptRecords
Returns the script records.- Returns:
- the requested result
-
getFeatureRecords
Returns the feature records.- Returns:
- the requested result
-
getFeatures
Returns the features represented byFeatureRecordlist.- Parameters:
-
scripts- the scripts -
language- the language - Returns:
- the requested result
-
getSpecificFeatures
Returns the specific features represented byFeatureRecordlist.- Parameters:
-
features-FeatureRecordlist -
specific- specific tags of the feature record - Returns:
- the requested result
-
getRequiredFeature
Returns the required feature represented byFeatureRecord.- Parameters:
-
scripts- the scripts -
language- the language - Returns:
- the requested result
-
getLookups
Returns the lookups.- Parameters:
-
features- the features - Returns:
- the requested result
-
getLookups
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:
-
trueif the specified glyph should be skipped,falseotherwise
-
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
Returns the language record.- Parameters:
-
otfScriptTag- the otf script tag - Returns:
- the requested result
-
getLanguageRecord
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
Reads the class definition from OpenType data.- Parameters:
-
classLocation- the class location - Returns:
- the requested result
-
readUShortArray
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
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
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
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
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
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
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
-