Unified Typesetting API M1-20040817

de.inghuimische.uta.typeset
Interface Script

All Superinterfaces:
QManageable
All Known Implementing Classes:
AbstractScript

public interface Script
extends QManageable

A script encapsulates the rules needed to typeset a single script and it does the actual typesetting.

Implementations of the same locale may differ in their support level which is one of QualityReport.NO_SUPPORT, QualityReport.MINIMAL_SUPPORT, QualityReport.BASIC_SUPPORT, QualityReport.ADVANCED_SUPPORT or QualityReport.FULL_SUPPORT. The support level is determinated by

Reference lists differ from script to script. For example an arabic script needs no support for hyphenation while latin based scripts may need them for full support. An arabic script may need ligatures on the basic support level while it is a full-level feature in latin scripts.

The central method is typeset(int, Glyph). Typesetting is context sensitive. Therefore a script may or may not put a glyph to the active embedding level for every call to typeset.

Author:
Christian Ziesemer

Method Summary
 void addScriptListener(ScriptListener aListener)
          Adds a script listener to the script.
 FeatureList getFeatures()
          The list of supported features.
 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 removeScriptListener(ScriptListener aListener)
          Removes a script listener.
 void setEmbeddingLevel(EmbeddingLevel anEmbeddingLevel)
          Sets the embedding level this script should place its generated glyphs in.
 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.
 

Method Detail

getLocale

public Locale getLocale()
Returns the locale supported by this script.

Returns:
The locale supported by this script.

getFeatures

public FeatureList getFeatures()
The list of supported features. Scripts may differ a lot in the features the list contains.

The returned features are compared to a reference list for the corresponding locale (if there is one).

Specified by:
getFeatures in interface QManageable
Returns:
A list of supported features.

setEmbeddingLevel

public void setEmbeddingLevel(EmbeddingLevel anEmbeddingLevel)
Sets the embedding level this script should place its generated glyphs in. This method is called either if the script has to wake up (previous glyphs got processed by another script) or if there's a inner embedding level (previous glyphs where processed by this script, but there's a change in directionaltiy, e.g.).

Parameters:
anEmbeddingLevel - The embedding level to place the generated gylphs.

relax

public void relax()
Tells the script that the next glyph will be processed by another script.


wakeup

public void wakeup(Script prevScript,
                   EmbeddingLevel prevEmbeddingLevel)
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)
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.

addScriptListener

public void addScriptListener(ScriptListener aListener)
Adds a script listener to the script. A ScriptListener gets informed if e.g. a new item is generated.

Parameters:
aListener - The listener to add.

removeScriptListener

public void removeScriptListener(ScriptListener aListener)
Removes a script listener.

Parameters:
aListener - The listener to remove.

newEmbeddingLevel

public EmbeddingLevel newEmbeddingLevel(int order)
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 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.