Class OTFAdvancedTypographicTableReader
java.lang.Object
org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader
OpenType Font (OTF) advanced typographic table reader. Used by @{Link org.apache.fop.fonts.truetype.TTFFile} to read advanced typographic tables (GDEF, GSUB, GPOS).
This work was originally authored by Glenn Adams (gadams@apache.org).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static final class(package private) static final class(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Stringprivate GlyphDefinitionTableprivate GlyphPositioningTableprivate GlyphSubstitutionTableprivate FontFileReaderprivate static org.apache.commons.logging.Logprivate OpenFontprivate Map<String, ScriptProcessor> private Listprivate GlyphMappingTableprivate List -
Constructor Summary
ConstructorsConstructorDescriptionConstruct anOTFAdvancedTypographicTableReaderinstance. -
Method Summary
Modifier and TypeMethodDescriptionprivate GlyphDefinitionTableConstruct the (internal representation of the) GDEF table based on previously parsed state.private GlyphSubtableconstructGDEFSubtable(Object[] stp) private Listprivate GlyphPositioningTableConstruct the (internal representation of the) GPOS table based on previously parsed state.private GlyphSubtableconstructGPOSSubtable(Object[] stp) private Listprivate GlyphSubstitutionTableConstruct the (internal representation of the) GSUB table based on previously parsed state.private GlyphSubtableconstructGSUBSubtable(Object[] stp) private Listprivate Mapprivate voidconstructLookupsFeature(Map lookups, String st, String lt, String fid) private voidprivate voidprivate voidprivate voidextractSESubState(int tableType, int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, int subtableFormat) getGDEF()Returns the GDEF table or null if none present.getGPOS()Returns the GPOS table or null if none present.getGSUB()Returns the GSUB table or null if none present.booleanDetermine if advanced (typographic) table is present.private voidprivate voidvoidreadAll()Read all advanced typographic tables.private intreadAlternateSubTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadAlternateSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadChainedContextualPosTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadChainedContextualPosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadChainedContextualPosTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadChainedContextualPosTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadChainedContextualSubTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadChainedContextualSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadChainedContextualSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadChainedContextualSubTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private GlyphClassTablereadClassDefTable(String label, long tableOffset) private GlyphClassTablereadClassDefTableFormat1(String label, long tableOffset, int classFormat) private GlyphClassTablereadClassDefTableFormat2(String label, long tableOffset, int classFormat) private voidreadCommonLayoutTables(OFTableName tableTag, long scriptList, long featureList, long lookupList) Read the common layout tables (used by GSUB and GPOS).private intreadContextualPosTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadContextualPosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadContextualPosTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadContextualPosTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadContextualSubTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadContextualSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadContextualSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadContextualSubTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private GlyphCoverageTablereadCoverageTable(String label, long tableOffset) private GlyphCoverageTablereadCoverageTableFormat1(String label, long tableOffset, int coverageFormat) private GlyphCoverageTablereadCoverageTableFormat2(String label, long tableOffset, int coverageFormat) private intreadCursivePosTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadCursivePosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadExtensionPosTable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) private voidreadExtensionPosTableFormat1(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset, int subtableFormat) private intreadExtensionSubTable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) private voidreadExtensionSubTableFormat1(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset, int subtableFormat) private voidreadFeatureList(OFTableName tableTag, long featureList) private voidreadFeatureTable(OFTableName tableTag, long featureTable, String featureTag, int featureIndex) private voidreadGDEF()Read the GDEF table.private voidreadGDEFAttachmentTable(OFTableName tableTag, int lookupSequence, long subtableOffset) private voidreadGDEFClassDefTable(OFTableName tableTag, int lookupSequence, long subtableOffset) private voidreadGDEFLigatureCaretTable(OFTableName tableTag, int lookupSequence, long subtableOffset) private voidreadGDEFMarkAttachmentTable(OFTableName tableTag, int lookupSequence, long subtableOffset) private voidreadGDEFMarkGlyphsTable(OFTableName tableTag, int lookupSequence, long subtableOffset) private voidreadGDEFMarkGlyphsTableFormat1(OFTableName tableTag, int lookupSequence, long subtableOffset, int subtableFormat) private voidreadGPOS()Read the GPOS table.private voidreadGPOSSubtable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) private voidreadGSUB()Read the GSUB table.private voidreadGSUBSubtable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) private voidreadLangSysTable(OFTableName tableTag, long langSysTable, String langSysTag) private intreadLigatureSubTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadLigatureSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadLookupList(OFTableName tableTag, long lookupList) private voidreadLookupTable(OFTableName tableTag, int lookupSequence, long lookupTable) private intreadMarkToBasePosTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadMarkToBasePosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadMarkToLigaturePosTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadMarkToLigaturePosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadMarkToMarkPosTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadMarkToMarkPosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadMultipleSubTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadMultipleSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadPairPosTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadPairPosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadPairPosTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private GlyphPositioningTable.AnchorreadPosAnchor(long anchorTableOffset) readPosDeviceTable(long subtableOffset, long deviceTableOffset) private GlyphPositioningTable.PairValues[]readPosPairSetTable(long subtableOffset, int pairSetTableOffset, int vf1, int vf2) private GlyphPositioningTable.PairValuesreadPosPairValues(long subtableOffset, boolean hasGlyph, int vf1, int vf2) private GlyphPositioningTable.ValuereadPosValue(long subtableOffset, int valueFormat) private intreadReverseChainedSingleSubTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadReverseChainedSingleSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private GlyphTable.RuleLookup[]readRuleLookups(int numLookups, String header) private voidreadScriptList(OFTableName tableTag, long scriptList) private voidreadScriptTable(OFTableName tableTag, long scriptTable, String scriptTag) private intreadSinglePosTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadSinglePosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadSinglePosTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private intreadSingleSubTable(int lookupType, int lookupFlags, long subtableOffset) private voidreadSingleSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidreadSingleSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private voidprivate voidprivate voidprivate StringtoString(int[] ia) helper method for formatting an integer array for output
-
Field Details
-
log
private static org.apache.commons.logging.Log log -
otf
-
in
-
gdef
-
gsub
-
gpos
-
seScripts
-
seLanguages
-
seFeatures
-
seMapping
-
seEntries
-
seSubtables
-
processors
-
defaultTag
-
-
Constructor Details
-
OTFAdvancedTypographicTableReader
Construct anOTFAdvancedTypographicTableReaderinstance.- Parameters:
otf- parent font file reader (must be non-null)in- font file reader (must be non-null)
-
-
Method Details
-
readAll
Read all advanced typographic tables.- Throws:
AdvancedTypographicTableFormatException- if ATT table has invalid format
-
hasAdvancedTable
public boolean hasAdvancedTable()Determine if advanced (typographic) table is present.- Returns:
- true if advanced (typographic) table is present
-
getGDEF
Returns the GDEF table or null if none present.- Returns:
- the GDEF table
-
getGSUB
Returns the GSUB table or null if none present.- Returns:
- the GSUB table
-
getGPOS
Returns the GPOS table or null if none present.- Returns:
- the GPOS table
-
readLangSysTable
private void readLangSysTable(OFTableName tableTag, long langSysTable, String langSysTag) throws IOException - Throws:
IOException
-
readScriptTable
private void readScriptTable(OFTableName tableTag, long scriptTable, String scriptTag) throws IOException - Throws:
IOException
-
readScriptList
- Throws:
IOException
-
readFeatureTable
private void readFeatureTable(OFTableName tableTag, long featureTable, String featureTag, int featureIndex) throws IOException - Throws:
IOException
-
readFeatureList
- Throws:
IOException
-
readCoverageTableFormat1
private GlyphCoverageTable readCoverageTableFormat1(String label, long tableOffset, int coverageFormat) throws IOException - Throws:
IOException
-
readCoverageTableFormat2
private GlyphCoverageTable readCoverageTableFormat2(String label, long tableOffset, int coverageFormat) throws IOException - Throws:
IOException
-
readCoverageTable
- Throws:
IOException
-
readClassDefTableFormat1
private GlyphClassTable readClassDefTableFormat1(String label, long tableOffset, int classFormat) throws IOException - Throws:
IOException
-
readClassDefTableFormat2
private GlyphClassTable readClassDefTableFormat2(String label, long tableOffset, int classFormat) throws IOException - Throws:
IOException
-
readClassDefTable
- Throws:
IOException
-
readSingleSubTableFormat1
private void readSingleSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readSingleSubTableFormat2
private void readSingleSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readSingleSubTable
private int readSingleSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readMultipleSubTableFormat1
private void readMultipleSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readMultipleSubTable
private int readMultipleSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readAlternateSubTableFormat1
private void readAlternateSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readAlternateSubTable
private int readAlternateSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readLigatureSubTableFormat1
private void readLigatureSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readLigatureSubTable
private int readLigatureSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readRuleLookups
- Throws:
IOException
-
readContextualSubTableFormat1
private void readContextualSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readContextualSubTableFormat2
private void readContextualSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readContextualSubTableFormat3
private void readContextualSubTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readContextualSubTable
private int readContextualSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readChainedContextualSubTableFormat1
private void readChainedContextualSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readChainedContextualSubTableFormat2
private void readChainedContextualSubTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readChainedContextualSubTableFormat3
private void readChainedContextualSubTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readChainedContextualSubTable
private int readChainedContextualSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readExtensionSubTableFormat1
private void readExtensionSubTableFormat1(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readExtensionSubTable
private int readExtensionSubTable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readReverseChainedSingleSubTableFormat1
private void readReverseChainedSingleSubTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readReverseChainedSingleSubTable
private int readReverseChainedSingleSubTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readGSUBSubtable
private void readGSUBSubtable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readPosDeviceTable
private GlyphPositioningTable.DeviceTable readPosDeviceTable(long subtableOffset, long deviceTableOffset) throws IOException - Throws:
IOException
-
readPosValue
private GlyphPositioningTable.Value readPosValue(long subtableOffset, int valueFormat) throws IOException - Throws:
IOException
-
readSinglePosTableFormat1
private void readSinglePosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readSinglePosTableFormat2
private void readSinglePosTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readSinglePosTable
private int readSinglePosTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readPosPairValues
private GlyphPositioningTable.PairValues readPosPairValues(long subtableOffset, boolean hasGlyph, int vf1, int vf2) throws IOException - Throws:
IOException
-
readPosPairSetTable
private GlyphPositioningTable.PairValues[] readPosPairSetTable(long subtableOffset, int pairSetTableOffset, int vf1, int vf2) throws IOException - Throws:
IOException
-
readPairPosTableFormat1
private void readPairPosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readPairPosTableFormat2
private void readPairPosTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readPairPosTable
private int readPairPosTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readPosAnchor
- Throws:
IOException
-
readCursivePosTableFormat1
private void readCursivePosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readCursivePosTable
private int readCursivePosTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readMarkToBasePosTableFormat1
private void readMarkToBasePosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readMarkToBasePosTable
private int readMarkToBasePosTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readMarkToLigaturePosTableFormat1
private void readMarkToLigaturePosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readMarkToLigaturePosTable
private int readMarkToLigaturePosTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readMarkToMarkPosTableFormat1
private void readMarkToMarkPosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readMarkToMarkPosTable
private int readMarkToMarkPosTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readContextualPosTableFormat1
private void readContextualPosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readContextualPosTableFormat2
private void readContextualPosTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readContextualPosTableFormat3
private void readContextualPosTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readContextualPosTable
private int readContextualPosTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readChainedContextualPosTableFormat1
private void readChainedContextualPosTableFormat1(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readChainedContextualPosTableFormat2
private void readChainedContextualPosTableFormat2(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readChainedContextualPosTableFormat3
private void readChainedContextualPosTableFormat3(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readChainedContextualPosTable
private int readChainedContextualPosTable(int lookupType, int lookupFlags, long subtableOffset) throws IOException - Throws:
IOException
-
readExtensionPosTableFormat1
private void readExtensionPosTableFormat1(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readExtensionPosTable
private int readExtensionPosTable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readGPOSSubtable
private void readGPOSSubtable(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readLookupTable
private void readLookupTable(OFTableName tableTag, int lookupSequence, long lookupTable) throws IOException - Throws:
IOException
-
readLookupList
- Throws:
IOException
-
readCommonLayoutTables
private void readCommonLayoutTables(OFTableName tableTag, long scriptList, long featureList, long lookupList) throws IOException Read the common layout tables (used by GSUB and GPOS).- Parameters:
tableTag- tag of table being readscriptList- offset to script list from beginning of font filefeatureList- offset to feature list from beginning of font filelookupList- offset to lookup list from beginning of font file- Throws:
IOException- In case of a I/O problem
-
readGDEFClassDefTable
private void readGDEFClassDefTable(OFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readGDEFAttachmentTable
private void readGDEFAttachmentTable(OFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readGDEFLigatureCaretTable
private void readGDEFLigatureCaretTable(OFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readGDEFMarkAttachmentTable
private void readGDEFMarkAttachmentTable(OFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readGDEFMarkGlyphsTableFormat1
private void readGDEFMarkGlyphsTableFormat1(OFTableName tableTag, int lookupSequence, long subtableOffset, int subtableFormat) throws IOException - Throws:
IOException
-
readGDEFMarkGlyphsTable
private void readGDEFMarkGlyphsTable(OFTableName tableTag, int lookupSequence, long subtableOffset) throws IOException - Throws:
IOException
-
readGDEF
Read the GDEF table.- Throws:
IOException- In case of a I/O problem
-
readGSUB
Read the GSUB table.- Throws:
IOException- In case of a I/O problem
-
readGPOS
Read the GPOS table.- Throws:
IOException- In case of a I/O problem
-
constructGDEF
Construct the (internal representation of the) GDEF table based on previously parsed state. -
constructGSUB
Construct the (internal representation of the) GSUB table based on previously parsed state. -
constructGPOS
Construct the (internal representation of the) GPOS table based on previously parsed state. -
constructLookupsFeature
-
constructLookupsFeatures
-
constructLookupsLanguage
-
constructLookupsLanguages
-
constructLookups
-
constructGDEFSubtables
-
constructGDEFSubtable
-
constructGSUBSubtables
-
constructGSUBSubtable
-
constructGPOSSubtables
-
constructGPOSSubtable
-
initATState
private void initATState() -
resetATState
private void resetATState() -
initATSubState
private void initATSubState() -
extractSESubState
private void extractSESubState(int tableType, int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, int subtableFormat) -
resetATSubState
private void resetATSubState() -
resetATStateAll
private void resetATStateAll() -
toString
helper method for formatting an integer array for output
-