Unified Typesetting API M1-20040817

de.inghuimische.uta.typeset
Class AbstractTypesetter

java.lang.Object
  extended byde.inghuimische.uta.typeset.AbstractTypesetter
All Implemented Interfaces:
QManageable, Typesetter
Direct Known Subclasses:
ExtensibleTypesetter

public abstract class AbstractTypesetter
extends Object
implements Typesetter

Abstract typesetter to ease implementation of typesetters. It implements the algorithm as described in my thesis (see typeset(UtaCharacterIterator)).

This class provides a feature list which should be used by subclasses.

This Typesetter is meant for single pass typesetting, so the scripts have to hyphenate in the first pass (if this is desired).

Author:
Christian Ziesemer

Field Summary
protected  Stack embeddingLevels
           
protected  FeatureList features
          Holds the features supported by this typesetter.
protected  EmbeddingLevel previousEmbeddingLevel
           
protected  Script previousScript
           
 
Constructor Summary
AbstractTypesetter()
           
 
Method Summary
protected  EmbeddingLevel fixItemPositions(EmbeddingLevel level, List breakpoints)
          Fixes the position of the items.
protected  void fixItemPositions(Iterator breakItems)
          Takes a list of prebreak-items and iterates over all items generated during typesetting.
 EmbeddingLevel getActiveEmbeddingLevel()
           
protected abstract  int getEmbeddingLevelOrder(int charIndex, Glyph glyph)
          Retrieves the order of the embedding level of the given glyph.
 FeatureList getFeatures()
          Returns a list of features the typesetter supports.
abstract  GlyphFactory getGlyphFactory()
          Returns the factory to use for resolving glyphs.
protected abstract  Iterator getItemIterator()
          Returns an iterator for iteration over all items.
abstract  boolean getJustifyText()
          Tells whether to justify text or not.
 EmbeddingLevel getRootLevel()
           
protected abstract  Script getScript(int aChar, Glyph aGlyph)
          This method is responsible for finding the right script for a given Glyph.
protected  EmbeddingLevel typeset(UtaCharacterIterator it)
          Typesets a sequence of glyphs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.inghuimische.uta.typeset.Typesetter
addScript, getJustificationAlgorithm, getLinebreakAlgorithm, getScript, getScripts, typeset
 

Field Detail

features

protected FeatureList features
Holds the features supported by this typesetter. Subclasses should add their features to this list.


previousScript

protected Script previousScript

previousEmbeddingLevel

protected EmbeddingLevel previousEmbeddingLevel

embeddingLevels

protected Stack embeddingLevels
Constructor Detail

AbstractTypesetter

public AbstractTypesetter()
Method Detail

typeset

protected EmbeddingLevel typeset(UtaCharacterIterator it)
Typesets a sequence of glyphs.

Following steps must be performed for every character:

  1. Generation of an uninitialized glyph
  2. Finding the correct embedding level and the correct script for the glyph
  3. Typesetting of the glyph

The method locates the proper script by calling getScript(int, Glyph). If the script changes between two scripts the Script.relax() method of the previous script is called as well as the Script.wakeup(Script, EmbeddingLevel) method of the current script. After this Script.typeset(int, Glyph) is called.

Parameters:
it - The iterator containing the characters to typeset.

fixItemPositions

protected EmbeddingLevel fixItemPositions(EmbeddingLevel level,
                                          List breakpoints)
Fixes the position of the items. After linebreaking is done it is clear which position each item has.

Parameters:
level - The level which item positions should be fixed.
breakpoints - The resolved breakpoints.

fixItemPositions

protected void fixItemPositions(Iterator breakItems)
Takes a list of prebreak-items and iterates over all items generated during typesetting.

Parameters:
breakItems - The iterator contains the various prebreak-items.

getItemIterator

protected abstract Iterator getItemIterator()
Returns an iterator for iteration over all items.

Returns:
An iterator for iteration over all items.

getGlyphFactory

public abstract GlyphFactory getGlyphFactory()
Returns the factory to use for resolving glyphs. It is recommeded that such a factory implements some kind of glyph recycling mechanism to minimize object creation overhead.

Returns:
The factory to use for resolving glyphs.

getEmbeddingLevelOrder

protected abstract int getEmbeddingLevelOrder(int charIndex,
                                              Glyph glyph)
Retrieves the order of the embedding level of the given glyph.

Parameters:
charIndex - The index of the char from the unmodified input of typeset(UtaCharacterIterator).
glyph - The glyph representing the index.
Returns:
The order of the embedding level as definied by the Unicode Bidi algorithm.

getScript

protected abstract Script getScript(int aChar,
                                    Glyph aGlyph)
This method is responsible for finding the right script for a given Glyph. This is a quite central aspect of the whole typeset process cause it decides by which script the glyph is to be typeset.

While simple implementations may always return the same script, complex should take a look into the glyph if there is already a matching attribute. Otherwise some processing is required.


getJustifyText

public abstract boolean getJustifyText()
Tells whether to justify text or not.

Returns:
true if the text should be justified, false otherwise.

getFeatures

public FeatureList getFeatures()
Description copied from interface: Typesetter
Returns a list of features the typesetter supports.

Specified by:
getFeatures in interface Typesetter
Returns:
A list of features the typesetter supports.

getActiveEmbeddingLevel

public EmbeddingLevel getActiveEmbeddingLevel()

getRootLevel

public EmbeddingLevel getRootLevel()

Unified Typesetting API M1-20040817


An inghuimische.de project.
Copyright (C) 2004 Christian Ziesemer; See the Mozilla Public License for more details.