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 String
private GlyphDefinitionTable
private GlyphPositioningTable
private GlyphSubstitutionTable
private FontFileReader
private static org.apache.commons.logging.Log
private OpenFont
private Map
<String, ScriptProcessor> private List
private GlyphMappingTable
private List
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct anOTFAdvancedTypographicTableReader
instance. -
Method Summary
Modifier and TypeMethodDescriptionprivate GlyphDefinitionTable
Construct the (internal representation of the) GDEF table based on previously parsed state.private GlyphSubtable
constructGDEFSubtable
(Object[] stp) private List
private GlyphPositioningTable
Construct the (internal representation of the) GPOS table based on previously parsed state.private GlyphSubtable
constructGPOSSubtable
(Object[] stp) private List
private GlyphSubstitutionTable
Construct the (internal representation of the) GSUB table based on previously parsed state.private GlyphSubtable
constructGSUBSubtable
(Object[] stp) private List
private Map
private void
constructLookupsFeature
(Map lookups, String st, String lt, String fid) private void
private void
private void
private void
extractSESubState
(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.boolean
Determine if advanced (typographic) table is present.private void
private void
void
readAll()
Read all advanced typographic tables.private int
readAlternateSubTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readAlternateSubTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readChainedContextualPosTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readChainedContextualPosTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readChainedContextualPosTableFormat2
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readChainedContextualPosTableFormat3
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readChainedContextualSubTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readChainedContextualSubTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readChainedContextualSubTableFormat2
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readChainedContextualSubTableFormat3
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private GlyphClassTable
readClassDefTable
(String label, long tableOffset) private GlyphClassTable
readClassDefTableFormat1
(String label, long tableOffset, int classFormat) private GlyphClassTable
readClassDefTableFormat2
(String label, long tableOffset, int classFormat) private void
readCommonLayoutTables
(OFTableName tableTag, long scriptList, long featureList, long lookupList) Read the common layout tables (used by GSUB and GPOS).private int
readContextualPosTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readContextualPosTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readContextualPosTableFormat2
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readContextualPosTableFormat3
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readContextualSubTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readContextualSubTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readContextualSubTableFormat2
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readContextualSubTableFormat3
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private GlyphCoverageTable
readCoverageTable
(String label, long tableOffset) private GlyphCoverageTable
readCoverageTableFormat1
(String label, long tableOffset, int coverageFormat) private GlyphCoverageTable
readCoverageTableFormat2
(String label, long tableOffset, int coverageFormat) private int
readCursivePosTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readCursivePosTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readExtensionPosTable
(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) private void
readExtensionPosTableFormat1
(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset, int subtableFormat) private int
readExtensionSubTable
(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) private void
readExtensionSubTableFormat1
(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset, int subtableFormat) private void
readFeatureList
(OFTableName tableTag, long featureList) private void
readFeatureTable
(OFTableName tableTag, long featureTable, String featureTag, int featureIndex) private void
readGDEF()
Read the GDEF table.private void
readGDEFAttachmentTable
(OFTableName tableTag, int lookupSequence, long subtableOffset) private void
readGDEFClassDefTable
(OFTableName tableTag, int lookupSequence, long subtableOffset) private void
readGDEFLigatureCaretTable
(OFTableName tableTag, int lookupSequence, long subtableOffset) private void
readGDEFMarkAttachmentTable
(OFTableName tableTag, int lookupSequence, long subtableOffset) private void
readGDEFMarkGlyphsTable
(OFTableName tableTag, int lookupSequence, long subtableOffset) private void
readGDEFMarkGlyphsTableFormat1
(OFTableName tableTag, int lookupSequence, long subtableOffset, int subtableFormat) private void
readGPOS()
Read the GPOS table.private void
readGPOSSubtable
(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) private void
readGSUB()
Read the GSUB table.private void
readGSUBSubtable
(int lookupType, int lookupFlags, int lookupSequence, int subtableSequence, long subtableOffset) private void
readLangSysTable
(OFTableName tableTag, long langSysTable, String langSysTag) private int
readLigatureSubTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readLigatureSubTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readLookupList
(OFTableName tableTag, long lookupList) private void
readLookupTable
(OFTableName tableTag, int lookupSequence, long lookupTable) private int
readMarkToBasePosTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readMarkToBasePosTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readMarkToLigaturePosTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readMarkToLigaturePosTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readMarkToMarkPosTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readMarkToMarkPosTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readMultipleSubTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readMultipleSubTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readPairPosTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readPairPosTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readPairPosTableFormat2
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private GlyphPositioningTable.Anchor
readPosAnchor
(long anchorTableOffset) readPosDeviceTable
(long subtableOffset, long deviceTableOffset) private GlyphPositioningTable.PairValues[]
readPosPairSetTable
(long subtableOffset, int pairSetTableOffset, int vf1, int vf2) private GlyphPositioningTable.PairValues
readPosPairValues
(long subtableOffset, boolean hasGlyph, int vf1, int vf2) private GlyphPositioningTable.Value
readPosValue
(long subtableOffset, int valueFormat) private int
readReverseChainedSingleSubTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readReverseChainedSingleSubTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private GlyphTable.RuleLookup[]
readRuleLookups
(int numLookups, String header) private void
readScriptList
(OFTableName tableTag, long scriptList) private void
readScriptTable
(OFTableName tableTag, long scriptTable, String scriptTag) private int
readSinglePosTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readSinglePosTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readSinglePosTableFormat2
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private int
readSingleSubTable
(int lookupType, int lookupFlags, long subtableOffset) private void
readSingleSubTableFormat1
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
readSingleSubTableFormat2
(int lookupType, int lookupFlags, long subtableOffset, int subtableFormat) private void
private void
private void
private String
toString
(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 anOTFAdvancedTypographicTableReader
instance.- 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
-