Class GlyphTable
java.lang.Object
org.docx4j.fonts.fop.complexscripts.fonts.GlyphTable
- Direct Known Subclasses:
GlyphDefinitionTable,GlyphPositioningTable,GlyphSubstitutionTable
public class GlyphTable
extends java.lang.Object
Base class for all advanced typographic glyph tables.
This work was originally authored by Glenn Adams (gadams@apache.org).
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGlyphTable.ChainedClassSequenceRuleTheChainedClassSequenceRuleclass implements a subclass ofClassSequenceRulethat supports matching on a specific glyph class sequence in a specific chained contextual.static classGlyphTable.ChainedCoverageSequenceRuleTheChainedCoverageSequenceRuleclass implements a subclass ofCoverageSequenceRulethat supports matching on a specific glyph class sequence in a specific chained contextual.static classGlyphTable.ChainedGlyphSequenceRuleTheChainedGlyphSequenceRuleclass implements a subclass ofGlyphSequenceRulethat supports matching on a specific glyph sequence in a specific chained contextual.static classGlyphTable.ClassSequenceRuleTheClassSequenceRuleclass implements a subclass ofRulethat supports matching on a specific glyph class sequence.static classGlyphTable.CoverageSequenceRuleTheCoverageSequenceRuleclass implements a subclass ofRulethat supports matching on a specific glyph coverage sequence.static classGlyphTable.GlyphSequenceRuleTheGlyphSequenceRuleclass implements a subclass ofRulethat supports matching on a specific glyph sequence.static classGlyphTable.HomogeneousRuleSetTheHomogenousRuleSetclass implements a collection of rules, which must be the same rule type (i.e., same concrete rule class) or null.static classGlyphTable.LookupSpecA structure class encapsulating a lookup specification as a <script,language,feature> tuple.static classGlyphTable.LookupTableTheLookupTableclass comprising an identifier and an ordered list of glyph subtables, each of which employ the same lookup identifier.static classGlyphTable.RuleTheRuleclass implements an array of rule lookup records.static classGlyphTable.RuleLookupTheRuleLookupclass implements a rule lookup record, comprising a glyph sequence index and a lookup table index (in an applicable lookup list).static classGlyphTable.RuleSetTheRuleSetclass implements a collection of rules, which may or may not be the same rule type.static classGlyphTable.UseSpecTheUseSpecclass comprises a lookup table reference and the feature that selected the lookup table. -
Field Summary
Fields Modifier and Type Field Description static intGLYPH_TABLE_TYPE_BASELINEbaseline glyph table typestatic intGLYPH_TABLE_TYPE_DEFINITIONdefinition glyph table typestatic intGLYPH_TABLE_TYPE_JUSTIFICATIONjustification glyph table typestatic intGLYPH_TABLE_TYPE_POSITIONINGpositioning glyph table typestatic intGLYPH_TABLE_TYPE_SUBSTITUTIONsubstitution glyph table typeprotected java.util.Map<java.lang.String,ScriptProcessor>processors -
Constructor Summary
Constructors Constructor Description GlyphTable(GlyphTable gdef, java.util.Map<GlyphTable.LookupSpec,java.util.List<java.lang.String>> lookups, java.util.Map<java.lang.String,ScriptProcessor> processors)Instantiate glyph table with specified lookups. -
Method Summary
Modifier and Type Method Description protected voidaddSubtable(GlyphSubtable subtable)Add a subtable.GlyphTable.UseSpec[]assembleLookups(java.lang.String[] features, java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> lookups)Assemble ordered array of lookup table use specifications according to the specified features and candidate lookups, where the order of the array is in accordance to the order of the applicable lookup list.java.util.List<GlyphTable.LookupTable>findLookupTables(GlyphTable.LookupSpec ls)Obtain ordered list of glyph lookup tables that match a specific lookup specification.protected voidfreezeSubtables()Freeze subtables, i.e., do not allow further subtable addition, and create resulting cached state.GlyphDefinitionTablegetGlyphDefinitions()Obtain glyph definition table.java.util.List<GlyphTable.LookupSpec>getLookups()Obtain list of all lookup specifications.GlyphTable.LookupTablegetLookupTable(java.lang.String lid)Obtain lookup table by lookup id.java.util.List<GlyphTable.LookupTable>getLookupTables()Obtain ordered list of all lookup tables, where order is by lookup identifier, which lexicographic ordering follows the lookup list order.static intgetTableTypeFromName(java.lang.String name)Obtain glyph table type from name.booleanhasFeature(java.lang.String script, java.lang.String language, java.lang.String feature)Determine if table supports specific feature, i.e., supports at least one lookup.java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>>matchLookups(java.lang.String script, java.lang.String language, java.lang.String feature)Match lookup specifications according to <script,language,feature> tuple, where '*' is a wildcard for a tuple component.java.util.List<GlyphTable.LookupSpec>matchLookupSpecs(java.lang.String script, java.lang.String language, java.lang.String feature)Match lookup specifications according to <script,language,feature> tuple, where '*' is a wildcard for a tuple component.static voidresolveLookupReferences(GlyphTable.RuleSet[] rsa, java.util.Map<java.lang.String,GlyphTable.LookupTable> lookupTables)Resolve references to lookup tables in a collection of rules sets.java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
GLYPH_TABLE_TYPE_SUBSTITUTION
public static final int GLYPH_TABLE_TYPE_SUBSTITUTIONsubstitution glyph table type- See Also:
- Constant Field Values
-
GLYPH_TABLE_TYPE_POSITIONING
public static final int GLYPH_TABLE_TYPE_POSITIONINGpositioning glyph table type- See Also:
- Constant Field Values
-
GLYPH_TABLE_TYPE_JUSTIFICATION
public static final int GLYPH_TABLE_TYPE_JUSTIFICATIONjustification glyph table type- See Also:
- Constant Field Values
-
GLYPH_TABLE_TYPE_BASELINE
public static final int GLYPH_TABLE_TYPE_BASELINEbaseline glyph table type- See Also:
- Constant Field Values
-
GLYPH_TABLE_TYPE_DEFINITION
public static final int GLYPH_TABLE_TYPE_DEFINITIONdefinition glyph table type- See Also:
- Constant Field Values
-
processors
-
-
Constructor Details
-
GlyphTable
public GlyphTable(GlyphTable gdef, java.util.Map<GlyphTable.LookupSpec,java.util.List<java.lang.String>> lookups, java.util.Map<java.lang.String,ScriptProcessor> processors)Instantiate glyph table with specified lookups.- Parameters:
gdef- glyph definition table that applieslookups- map from lookup specs to lookup tables
-
-
Method Details
-
getGlyphDefinitions
Obtain glyph definition table.- Returns:
- (possibly null) glyph definition table
-
getLookups
Obtain list of all lookup specifications.- Returns:
- (possibly empty) list of all lookup specifications
-
getLookupTables
Obtain ordered list of all lookup tables, where order is by lookup identifier, which lexicographic ordering follows the lookup list order.- Returns:
- (possibly empty) ordered list of all lookup tables
-
getLookupTable
Obtain lookup table by lookup id. This method is used by test code, and provides access to embedded lookups not normally accessed by {script, language, feature} lookup spec.- Parameters:
lid- lookup id- Returns:
- table associated with lookup id or null if none
-
addSubtable
Add a subtable.- Parameters:
subtable- a (non-null) glyph subtable
-
freezeSubtables
protected void freezeSubtables()Freeze subtables, i.e., do not allow further subtable addition, and create resulting cached state. -
matchLookupSpecs
public java.util.List<GlyphTable.LookupSpec> matchLookupSpecs(java.lang.String script, java.lang.String language, java.lang.String feature)Match lookup specifications according to <script,language,feature> tuple, where '*' is a wildcard for a tuple component.- Parameters:
script- a script identifierlanguage- a language identifierfeature- a feature identifier- Returns:
- a (possibly empty) array of matching lookup specifications
-
matchLookups
public java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> matchLookups(java.lang.String script, java.lang.String language, java.lang.String feature)Match lookup specifications according to <script,language,feature> tuple, where '*' is a wildcard for a tuple component.- Parameters:
script- a script identifierlanguage- a language identifierfeature- a feature identifier- Returns:
- a (possibly empty) map from matching lookup specifications to lists of corresponding lookup tables
-
findLookupTables
Obtain ordered list of glyph lookup tables that match a specific lookup specification.- Parameters:
ls- a (non-null) lookup specification- Returns:
- a (possibly empty) ordered list of lookup tables whose corresponding lookup specifications match the specified lookup spec
-
assembleLookups
public GlyphTable.UseSpec[] assembleLookups(java.lang.String[] features, java.util.Map<GlyphTable.LookupSpec,java.util.List<GlyphTable.LookupTable>> lookups)Assemble ordered array of lookup table use specifications according to the specified features and candidate lookups, where the order of the array is in accordance to the order of the applicable lookup list.- Parameters:
features- array of feature identifiers to applylookups- a mapping from lookup specifications to lists of look tables from which to select lookup tables according to the specified features- Returns:
- ordered array of assembled lookup table use specifications
-
hasFeature
public boolean hasFeature(java.lang.String script, java.lang.String language, java.lang.String feature)Determine if table supports specific feature, i.e., supports at least one lookup.- Parameters:
script- to qualify feature lookuplanguage- to qualify feature lookupfeature- to test- Returns:
- true if feature supported (has at least one lookup)
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getTableTypeFromName
public static int getTableTypeFromName(java.lang.String name)Obtain glyph table type from name.- Parameters:
name- of table type to map to type value- Returns:
- glyph table type (as an integer constant)
-
resolveLookupReferences
public static void resolveLookupReferences(GlyphTable.RuleSet[] rsa, java.util.Map<java.lang.String,GlyphTable.LookupTable> lookupTables)Resolve references to lookup tables in a collection of rules sets.- Parameters:
rsa- array of rule setslookupTables- map from lookup table identifers, e.g. "lu4", to lookup tables
-