Class GlyphSubtable
java.lang.Object
org.docx4j.fonts.fop.complexscripts.fonts.GlyphSubtable
- All Implemented Interfaces:
java.lang.Comparable
- Direct Known Subclasses:
GlyphDefinitionSubtable,GlyphPositioningSubtable,GlyphSubstitutionSubtable
public abstract class GlyphSubtable
extends java.lang.Object
implements java.lang.Comparable
The GlyphSubtable implements an abstract glyph subtable that
encapsulates identification, type, format, and coverage information.
This work was originally authored by Glenn Adams (gadams@apache.org).
-
Field Summary
Fields Modifier and Type Field Description static intLF_IGNORE_BASElookup flag - ignore base glyphsstatic intLF_IGNORE_LIGATURElookup flag - ignore ligaturesstatic intLF_IGNORE_MARKlookup flag - ignore marksstatic intLF_INTERNAL_USE_REVERSE_SCANinternal flag - use reverse scanstatic intLF_MARK_ATTACHMENT_TYPElookup flag - mark attachment typestatic intLF_RESERVEDlookup flag - reservedstatic intLF_RIGHT_TO_LEFTlookup flag - right to leftstatic intLF_USE_MARK_FILTERING_SETlookup flag - use mark filtering set -
Constructor Summary
Constructors Modifier Constructor Description protectedGlyphSubtable(java.lang.String lookupId, int sequence, int flags, int format, GlyphMappingTable mapping)Instantiate this glyph subtable. -
Method Summary
Modifier and Type Method Description intcompareTo(java.lang.Object o)booleanequals(java.lang.Object o)GlyphClassMappinggetClasses()GlyphCoverageMappinggetCoverage()intgetCoverageIndex(int gid)Map glyph id to coverage index.intgetCoverageSize()Map glyph id to coverage index.abstract java.util.ListgetEntries()intgetFlags()static intgetFlags(GlyphSubtable[] subtables)Determine consistent flags for a set of subtables.intgetFormat()GlyphDefinitionTablegetGDEF()java.lang.StringgetLookupId()intgetSequence()GlyphTablegetTable()abstract intgetTableType()abstract intgetType()abstract java.lang.StringgetTypeName()inthashCode()abstract booleanisCompatible(GlyphSubtable subtable)Determine if a glyph subtable is compatible with this glyph subtable.voidresolveLookupReferences(java.util.Map<java.lang.String,GlyphTable.LookupTable> lookupTables)Resolve references to lookup tables, e.g., in RuleLookup, to the lookup tables themselves.voidsetTable(GlyphTable table)Establish a weak reference from this subtable to its parent table.abstract booleanusesReverseScan()static booleanusesReverseScan(GlyphSubtable[] subtables)Determine if any of the specified subtables uses reverse scanning.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
LF_RIGHT_TO_LEFT
public static final int LF_RIGHT_TO_LEFTlookup flag - right to left- See Also:
- Constant Field Values
-
LF_IGNORE_BASE
public static final int LF_IGNORE_BASElookup flag - ignore base glyphs- See Also:
- Constant Field Values
-
LF_IGNORE_LIGATURE
public static final int LF_IGNORE_LIGATURElookup flag - ignore ligatures- See Also:
- Constant Field Values
-
LF_IGNORE_MARK
public static final int LF_IGNORE_MARKlookup flag - ignore marks- See Also:
- Constant Field Values
-
LF_USE_MARK_FILTERING_SET
public static final int LF_USE_MARK_FILTERING_SETlookup flag - use mark filtering set- See Also:
- Constant Field Values
-
LF_RESERVED
public static final int LF_RESERVEDlookup flag - reserved- See Also:
- Constant Field Values
-
LF_MARK_ATTACHMENT_TYPE
public static final int LF_MARK_ATTACHMENT_TYPElookup flag - mark attachment type- See Also:
- Constant Field Values
-
LF_INTERNAL_USE_REVERSE_SCAN
public static final int LF_INTERNAL_USE_REVERSE_SCANinternal flag - use reverse scan- See Also:
- Constant Field Values
-
-
Constructor Details
-
GlyphSubtable
protected GlyphSubtable(java.lang.String lookupId, int sequence, int flags, int format, GlyphMappingTable mapping)Instantiate this glyph subtable.- Parameters:
lookupId- lookup identifier, having form of "lu%d" where %d is index of lookup in lookup listsequence- subtable sequence (within lookup), starting with zeroflags- subtable flagsformat- subtable formatmapping- subtable mapping table
-
-
Method Details
-
getLookupId
public java.lang.String getLookupId()- Returns:
- this subtable's lookup identifer
-
getTableType
public abstract int getTableType()- Returns:
- this subtable's table type
-
getType
public abstract int getType()- Returns:
- this subtable's type
-
getTypeName
public abstract java.lang.String getTypeName()- Returns:
- this subtable's type name
-
isCompatible
Determine if a glyph subtable is compatible with this glyph subtable. Two glyph subtables are compatible if the both may appear in a single lookup table.- Parameters:
subtable- a glyph subtable to determine compatibility- Returns:
- true if specified subtable is compatible with this glyph subtable, where by compatible is meant that they share the same lookup type
-
usesReverseScan
public abstract boolean usesReverseScan()- Returns:
- true if subtable uses reverse scanning of glyph sequence, meaning from the last glyph in a glyph sequence to the first glyph
-
getSequence
public int getSequence()- Returns:
- this subtable's sequence (index) within lookup
-
getFlags
public int getFlags()- Returns:
- this subtable's flags
-
getFormat
public int getFormat()- Returns:
- this subtable's format
-
getGDEF
- Returns:
- this subtable's governing glyph definition table or null if none available
-
getCoverage
- Returns:
- this subtable's coverage mapping or null if mapping is not a coverage mapping
-
getClasses
- Returns:
- this subtable's class mapping or null if mapping is not a class mapping
-
getEntries
public abstract java.util.List getEntries()- Returns:
- this subtable's lookup entries
-
getTable
- Returns:
- this subtable's parent table (or null if undefined)
-
setTable
Establish a weak reference from this subtable to its parent table. If table parameter is specified asnull, then clear and remove weak reference.- Parameters:
table- the table or null- Throws:
java.lang.IllegalStateException- if table is already set to non-null
-
resolveLookupReferences
public void resolveLookupReferences(java.util.Map<java.lang.String,GlyphTable.LookupTable> lookupTables)Resolve references to lookup tables, e.g., in RuleLookup, to the lookup tables themselves.- Parameters:
lookupTables- map from lookup table identifers, e.g. "lu4", to lookup tables
-
getCoverageIndex
public int getCoverageIndex(int gid)Map glyph id to coverage index.- Parameters:
gid- glyph id- Returns:
- the corresponding coverage index of the specified glyph id
-
getCoverageSize
public int getCoverageSize()Map glyph id to coverage index.- Returns:
- the corresponding coverage index of the specified glyph id
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object- Returns:
- true if the lookup identifier and the sequence number of the specified subtable is the same as the lookup identifier and sequence number of this subtable
-
compareTo
public int compareTo(java.lang.Object o)- Specified by:
compareToin interfacejava.lang.Comparable- Returns:
- the result of comparing the lookup identifier and the sequence number of the specified subtable with the lookup identifier and sequence number of this subtable
-
usesReverseScan
Determine if any of the specified subtables uses reverse scanning.- Parameters:
subtables- array of glyph subtables- Returns:
- true if any of the specified subtables uses reverse scanning.
-
getFlags
Determine consistent flags for a set of subtables.- Parameters:
subtables- array of glyph subtables- Returns:
- consistent flags
- Throws:
java.lang.IllegalStateException- if inconsistent flags
-