Class GlyphSubstitutionSubtable
- java.lang.Object
-
- org.apache.fop.complexscripts.fonts.GlyphSubtable
-
- org.apache.fop.complexscripts.fonts.GlyphSubstitutionSubtable
-
- All Implemented Interfaces:
java.lang.Comparable
,GlyphSubstitution
- Direct Known Subclasses:
GlyphSubstitutionTable.AlternateSubtable
,GlyphSubstitutionTable.ChainedContextualSubtable
,GlyphSubstitutionTable.ContextualSubtable
,GlyphSubstitutionTable.LigatureSubtable
,GlyphSubstitutionTable.MultipleSubtable
,GlyphSubstitutionTable.ReverseChainedSingleSubtable
,GlyphSubstitutionTable.SingleSubtable
public abstract class GlyphSubstitutionSubtable extends GlyphSubtable implements GlyphSubstitution
The
GlyphSubstitutionSubtable
implements an abstract base of a glyph substitution subtable, providing a default implementation of theGlyphSubstitution
interface.This work was originally authored by Glenn Adams (gadams@apache.org).
-
-
Field Summary
Fields Modifier and Type Field Description private static GlyphSubstitutionState
STATE
-
Fields inherited from class org.apache.fop.complexscripts.fonts.GlyphSubtable
LF_IGNORE_BASE, LF_IGNORE_LIGATURE, LF_IGNORE_MARK, LF_INTERNAL_USE_REVERSE_SCAN, LF_MARK_ATTACHMENT_TYPE, LF_RESERVED, LF_RIGHT_TO_LEFT, LF_USE_MARK_FILTERING_SET
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GlyphSubstitutionSubtable(java.lang.String id, int sequence, int flags, int format, GlyphCoverageTable coverage)
Instantiate aGlyphSubstitutionSubtable
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getTableType()
java.lang.String
getTypeName()
boolean
isCompatible(GlyphSubtable subtable)
Determine if a glyph subtable is compatible with this glyph subtable.boolean
substitute(GlyphSubstitutionState ss)
Perform glyph substitution at the current index, mutating the substitution state object as required.static GlyphSequence
substitute(GlyphSubstitutionState ss, GlyphSubstitutionSubtable[] sta, int sequenceIndex)
Apply substitutions using specified state and subtable array.static GlyphSequence
substitute(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, GlyphSubstitutionSubtable[] sta, ScriptContextTester sct)
Apply substitutions.boolean
usesReverseScan()
-
Methods inherited from class org.apache.fop.complexscripts.fonts.GlyphSubtable
compareTo, equals, getClasses, getCoverage, getCoverageIndex, getCoverageSize, getEntries, getFlags, getFlags, getFormat, getGDEF, getLookupId, getSequence, getTable, getType, hashCode, resolveLookupReferences, setTable, usesReverseScan
-
-
-
-
Field Detail
-
STATE
private static final GlyphSubstitutionState STATE
-
-
Constructor Detail
-
GlyphSubstitutionSubtable
protected GlyphSubstitutionSubtable(java.lang.String id, int sequence, int flags, int format, GlyphCoverageTable coverage)
Instantiate aGlyphSubstitutionSubtable
.- Parameters:
id
- subtable identifiersequence
- subtable sequenceflags
- subtable flagsformat
- subtable formatcoverage
- subtable coverage table
-
-
Method Detail
-
getTableType
public int getTableType()
- Specified by:
getTableType
in classGlyphSubtable
- Returns:
- this subtable's table type
-
getTypeName
public java.lang.String getTypeName()
- Specified by:
getTypeName
in classGlyphSubtable
- Returns:
- this subtable's type name
-
isCompatible
public boolean isCompatible(GlyphSubtable subtable)
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.- Specified by:
isCompatible
in classGlyphSubtable
- 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 boolean usesReverseScan()
- Specified by:
usesReverseScan
in classGlyphSubtable
- Returns:
- true if subtable uses reverse scanning of glyph sequence, meaning from the last glyph in a glyph sequence to the first glyph
-
substitute
public boolean substitute(GlyphSubstitutionState ss)
Perform glyph substitution at the current index, mutating the substitution state object as required. Only the context associated with the current index is processed.- Specified by:
substitute
in interfaceGlyphSubstitution
- Parameters:
ss
- glyph substitution state object- Returns:
- true if the glyph subtable was applied, meaning that the current context matches the associated input context glyph coverage table
-
substitute
public static final GlyphSequence substitute(GlyphSubstitutionState ss, GlyphSubstitutionSubtable[] sta, int sequenceIndex)
Apply substitutions using specified state and subtable array. For each position in input sequence, apply subtables in order until some subtable applies or none remain. If no subtable applied or no input was consumed for a given position, then apply default action (copy input glyph and advance). IfsequenceIndex
is non-negative, then apply subtables only when current position matchessequenceIndex
in relation to the starting position. Furthermore, upon successful application atsequenceIndex
, then apply default action for all remaining glyphs in input sequence.- Parameters:
ss
- substitution statesta
- array of subtables to applysequenceIndex
- if non negative, then apply subtables only at specified sequence index- Returns:
- output glyph sequence
-
substitute
public static final GlyphSequence substitute(GlyphSequence gs, java.lang.String script, java.lang.String language, java.lang.String feature, GlyphSubstitutionSubtable[] sta, ScriptContextTester sct)
Apply substitutions.- Parameters:
gs
- input glyph sequencescript
- taglanguage
- tagfeature
- tagsta
- subtable arraysct
- script context tester- Returns:
- output glyph sequence
-
-