Unified Typesetting API M1-20040817

de.inghuimische.uta.test
Class SimpleScript

java.lang.Object
  extended byde.inghuimische.uta.typeset.AbstractScript
      extended byde.inghuimische.uta.test.SimpleScript
All Implemented Interfaces:
QManageable, Script

public class SimpleScript
extends AbstractScript

A minimal implementation of the script interface. It only handles chars and generates SimpleItems. Item generation is triggered by the space character.

Author:
Christian Ziesemer

Field Summary
 
Fields inherited from class de.inghuimische.uta.typeset.AbstractScript
embeddingLevel, features, listener
 
Constructor Summary
SimpleScript()
           
 
Method Summary
protected  void fireNewItem(Item newItem)
          A script has to call this method if it generates a new item.
 Locale getLocale()
          Returns the locale supported by this script.
 EmbeddingLevel newEmbeddingLevel(int order)
          Returns the embedding level to use for the given order.
 void relax()
          Tells the script that the next glyph will be processed by another script.
 void typeset(int aChar, Glyph aGlyph)
          The typesetter calls this method for every glyph this script should set.
 void wakeup(Script prevScript, EmbeddingLevel prevEmbeddingLevel)
          This method tells a script to prepare for typesetting.
 
Methods inherited from class de.inghuimische.uta.typeset.AbstractScript
addScriptListener, getFeatures, removeScriptListener, setEmbeddingLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleScript

public SimpleScript()
Method Detail

getLocale

public Locale getLocale()
Description copied from interface: Script
Returns the locale supported by this script.

Returns:
The locale supported by this script.

relax

public void relax()
Description copied from interface: Script
Tells the script that the next glyph will be processed by another script.


wakeup

public void wakeup(Script prevScript,
                   EmbeddingLevel prevEmbeddingLevel)
Description copied from interface: Script
This method tells a script to prepare for typesetting. It is called in multiscript environments, when a switch between two scripts occurs. It is called with the values null, null if there is no previous script (single language environment). Therefore simple script implementations will most probably not interpret the arguments.

This method is the glue between two scripts. The arguments are meant to deal with some complicated situations, especially with interpunctation issues. Imagine you have something like ,car MEANS CAR' in logical order, where uppercase is Arabic and lowercase is English and the quotion marks are also Arabic. Than the result should look like 'RAC SNAEM car, in optical order (the single glyphs are of course not mirrored in this example although it would be useful). Note that the opening mark now is at the right of the word car whereas it was at the left before. In such a case the optimal spacing would be r, and not ,c.

Parameters:
prevScript - The previously called script. null if there' no previous script.
prevEmbeddingLevel - The previous embedding level. null if there is no previous script.

typeset

public void typeset(int aChar,
                    Glyph aGlyph)
Description copied from interface: Script
The typesetter calls this method for every glyph this script should set. The glyphs are in logical order. The given glyph is empty that is it has currently no glyph index assigned and therefore no shape and so on. A script may fill the glyph and put it into the active embedding level or will have to cache it and wait for further empty glyphs to perform a substitution and put this new glyph to the level.

Parameters:
aChar - The character to typeset. Although aGlyph already contains a reference this is simply to save a method call.
aGlyph - An empty glyph which has to be filled.

fireNewItem

protected void fireNewItem(Item newItem)
Description copied from class: AbstractScript
A script has to call this method if it generates a new item. Informs all listeners of the newly generated item.

Overrides:
fireNewItem in class AbstractScript
Parameters:
newItem - The newly generated item.

newEmbeddingLevel

public EmbeddingLevel newEmbeddingLevel(int order)
Description copied from interface: Script
Returns the embedding level to use for the given order. A typesetter calls this method if there's a change in the embedding level order and therefore a new embedding level is needed. Normally the Script.setEmbeddingLevel(EmbeddingLevel) method is called directly afterwards.

Parameters:
order - The order of the embedding level.
Returns:
The embedding level to use.

Unified Typesetting API M1-20040817


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