Class GlyphTable.LookupTable
- java.lang.Object
-
- org.apache.fop.complexscripts.fonts.GlyphTable.LookupTable
-
- All Implemented Interfaces:
java.lang.Comparable
- Enclosing class:
- GlyphTable
public static class GlyphTable.LookupTable extends java.lang.Object implements java.lang.Comparable
TheLookupTable
class comprising an identifier and an ordered list of glyph subtables, each of which employ the same lookup identifier.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
doesPos
private boolean
doesSub
private boolean
frozen
private java.lang.String
id
private int
idOrdinal
private java.util.List<GlyphSubtable>
subtables
private GlyphSubtable[]
subtablesArray
private static GlyphSubtable[]
subtablesArrayEmpty
-
Constructor Summary
Constructors Constructor Description LookupTable(java.lang.String id, java.util.List<GlyphSubtable> subtables)
Instantiate a LookupTable.LookupTable(java.lang.String id, GlyphSubtable subtable)
Instantiate a LookupTable.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addSubtable(GlyphSubtable subtable)
Add a subtable into this lookup table's collecion of subtables according to its natural order.int
compareTo(java.lang.Object o)
boolean
equals(java.lang.Object o)
void
freezeSubtables(java.util.Map<java.lang.String,GlyphTable.LookupTable> lookupTables)
Freeze subtables, i.e., do not allow further subtable addition, and create resulting cached state.GlyphSubtable[]
getSubtables()
int
hashCode()
private static java.util.List<GlyphSubtable>
makeSingleton(GlyphSubtable subtable)
boolean
performsPositioning()
Determine if this glyph table performs positioning.boolean
performsSubstitution()
Determine if this glyph table performs substitution.boolean
position(GlyphPositioningState ps, int sequenceIndex)
Perform positioning processing on an existing glyph positioning state object using this lookup table's subtables.boolean
position(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct)
Perform positioning processing using this lookup table's subtables.private void
resolveLookupReferences(GlyphSubtable[] subtables, java.util.Map<java.lang.String,GlyphTable.LookupTable> lookupTables)
GlyphSequence
substitute(GlyphSubstitutionState ss, int sequenceIndex)
Perform substitution processing on an existing glyph substitution state object using this lookup table's subtables.GlyphSequence
substitute(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, ScriptContextTester sct)
Perform substitution processing using this lookup table's subtables.java.lang.String
toString()
private void
validateSubtable(GlyphSubtable subtable)
-
-
-
Field Detail
-
id
private final java.lang.String id
-
idOrdinal
private final int idOrdinal
-
subtables
private final java.util.List<GlyphSubtable> subtables
-
doesSub
private boolean doesSub
-
doesPos
private boolean doesPos
-
frozen
private boolean frozen
-
subtablesArray
private GlyphSubtable[] subtablesArray
-
subtablesArrayEmpty
private static GlyphSubtable[] subtablesArrayEmpty
-
-
Constructor Detail
-
LookupTable
public LookupTable(java.lang.String id, GlyphSubtable subtable)
Instantiate a LookupTable.- Parameters:
id
- the lookup table's identifiersubtable
- an initial subtable (or null)
-
LookupTable
public LookupTable(java.lang.String id, java.util.List<GlyphSubtable> subtables)
Instantiate a LookupTable.- Parameters:
id
- the lookup table's identifiersubtables
- a pre-poplated list of subtables or null
-
-
Method Detail
-
getSubtables
public GlyphSubtable[] getSubtables()
- Returns:
- the subtables as an array
-
addSubtable
public boolean addSubtable(GlyphSubtable subtable)
Add a subtable into this lookup table's collecion of subtables according to its natural order.- Parameters:
subtable
- to add- Returns:
- true if subtable was not already present, otherwise false
-
validateSubtable
private void validateSubtable(GlyphSubtable subtable)
-
freezeSubtables
public void freezeSubtables(java.util.Map<java.lang.String,GlyphTable.LookupTable> lookupTables)
Freeze subtables, i.e., do not allow further subtable addition, and create resulting cached state. In addition, resolve any references to lookup tables that appear in this lookup table's subtables.- Parameters:
lookupTables
- map from lookup table identifers, e.g. "lu4", to lookup tables
-
resolveLookupReferences
private void resolveLookupReferences(GlyphSubtable[] subtables, java.util.Map<java.lang.String,GlyphTable.LookupTable> lookupTables)
-
performsSubstitution
public boolean performsSubstitution()
Determine if this glyph table performs substitution.- Returns:
- true if it performs substitution
-
substitute
public GlyphSequence substitute(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, ScriptContextTester sct)
Perform substitution processing using this lookup table's subtables.- Parameters:
gs
- an input glyph sequencescript
- a script identifierlanguage
- a language identifierfeature
- a feature identifiersct
- a script specific context tester (or null)- Returns:
- the substituted (output) glyph sequence
-
substitute
public GlyphSequence substitute(GlyphSubstitutionState ss, int sequenceIndex)
Perform substitution processing on an existing glyph substitution state object using this lookup table's subtables.- Parameters:
ss
- a glyph substitution state objectsequenceIndex
- if non negative, then apply subtables only at specified sequence index- Returns:
- the substituted (output) glyph sequence
-
performsPositioning
public boolean performsPositioning()
Determine if this glyph table performs positioning.- Returns:
- true if it performs positioning
-
position
public boolean position(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, int fontSize, int[] widths, int[][] adjustments, ScriptContextTester sct)
Perform positioning processing using this lookup table's subtables.- Parameters:
gs
- an input glyph sequencescript
- a script identifierlanguage
- a language identifierfeature
- a feature identifierfontSize
- size in device unitswidths
- array of default advancements for each glyph in fontadjustments
- accumulated adjustments array (sequence) of 4-tuples of placement [PX,PY] and advance [AX,AY] adjustments, in that order, with one 4-tuple for each element of glyph sequencesct
- a script specific context tester (or null)- Returns:
- true if some adjustment is not zero; otherwise, false
-
position
public boolean position(GlyphPositioningState ps, int sequenceIndex)
Perform positioning processing on an existing glyph positioning state object using this lookup table's subtables.- Parameters:
ps
- a glyph positioning state objectsequenceIndex
- if non negative, then apply subtables only at specified sequence index- Returns:
- true if some adjustment is not zero; otherwise, false
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
- Returns:
- true if identifier of the specified lookup table is the same as the identifier of this lookup table
-
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareTo
in interfacejava.lang.Comparable
- Returns:
- the result of comparing the identifier of the specified lookup table with the identifier of this lookup table; lookup table identifiers take the form "lu(DIGIT)+", with comparison based on numerical ordering of numbers expressed by (DIGIT)+.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
makeSingleton
private static java.util.List<GlyphSubtable> makeSingleton(GlyphSubtable subtable)
-
-