Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

OpenTypeLayoutEngine Class Reference

OpenTypeLayoutEngine implements complex text layout for OpenType fonts - that is fonts which have GSUB and GPOS tables associated with them. More...

#include <OpenTypeLayoutEngine.h>

Inheritance diagram for OpenTypeLayoutEngine::

LayoutEngine UObject UMemory ArabicOpenTypeLayoutEngine HanOpenTypeLayoutEngine IndicOpenTypeLayoutEngine UnicodeArabicOpenTypeLayoutEngine List of all members.

Public Methods

 OpenTypeLayoutEngine (const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const GlyphSubstitutionTableHeader *gsubTable)
 This is the main constructor. More...

 OpenTypeLayoutEngine (const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode)
 This constructor is used when the font requires a "canned" GSUB table which can't be known until after this constructor has been invoked. More...

virtual ~OpenTypeLayoutEngine ()
 The destructor, virtual for correct polymorphic invocation. More...

virtual UClassID getDynamicClassID () const
 ICU "poor man's RTTI", returns a UClassID for the actual class. More...


Static Public Methods

LETag getScriptTag (le_int32 scriptCode)
 A convenience method used to convert the script code into the four byte script tag required by OpenType. More...

LETag getLangSysTag (le_int32 languageCode)
 A convenience method used to convert the langauge code into the four byte langauge tag required by OpenType. More...

UClassID getStaticClassID ()
 ICU "poor man's RTTI", returns a UClassID for this class. More...


Protected Methods

virtual le_int32 characterProcessing (const LEUnicode[], le_int32 offset, le_int32 count, le_int32 max, le_bool, LEUnicode *&, le_int32 *&, const LETag **&, LEErrorCode &success)
 This method does the OpenType character processing. More...

virtual le_int32 glyphProcessing (const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, const LETag **&featureTags, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success)
 This method does character to glyph mapping, and applies the GSUB table. More...

virtual le_int32 glyphPostProcessing (LEGlyphID tempGlyphs[], le_int32 tempCharIndices[], le_int32 tempGlyphCount, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success)
 This method does any processing necessary to convert "fake" glyph indices used by the glyphProcessing method into "real" glyph indices which can be used to render the text. More...

virtual le_int32 computeGlyphs (const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, LEGlyphID *&glyphs, le_int32 *&charIndices, LEErrorCode &success)
 This method applies the characterProcessing, glyphProcessing and glyphPostProcessing methods. More...

virtual void adjustGlyphPositions (const LEUnicode chars[], le_int32 offset, le_int32 count, le_bool reverse, LEGlyphID glyphs[], le_int32 glyphCount, float positions[], LEErrorCode &success)
 This method uses the GPOS table, if there is one, to adjust the glyph positions. More...

virtual void reset ()
 This method frees the feature tag array so that the OpenTypeLayoutEngine can be reused for different text. More...


Protected Attributes

const LETag ** fFeatureTags
 An array of pointers to four byte feature tags. More...

const LETagfFeatureOrder
 A list of tags in the order in which the features in the font should be applied, as opposed to using the order of the lookups in the font. More...

const GlyphSubstitutionTableHeader * fGSUBTable
 The address of the GSUB table. More...

const GlyphDefinitionTableHeader * fGDEFTable
 The address of the GDEF table. More...

const GlyphPositioningTableHeader * fGPOSTable
 The address of the GPOS table. More...

LEGlyphFilterfSubstitutionFilter
 An optional filter used to inhibit substitutions preformed by the GSUB table. More...

LETag fScriptTag
 The four byte script tag. More...

LETag fLangSysTag
 The four byte language tag. More...


Private Methods

void setScriptAndLanguageTags ()
 This method is used by the constructors to convert the script and language codes to four byte tags and save them. More...


Static Private Attributes

const LETag scriptTags []
 The array of script tags, indexed by script code. More...

const LETag languageTags []
 The array of language tags, indexed by language code. More...

const char fgClassID
 The address of this static class variable serves as this class's ID for ICU "poor man's RTTI". More...


Detailed Description

OpenTypeLayoutEngine implements complex text layout for OpenType fonts - that is fonts which have GSUB and GPOS tables associated with them.

In order to do this, the glyph processsing step described for LayoutEngine is further broken into three steps:

1) Character processing - this step analyses the characters and assigns a list of OpenType feature tags to each one. It may also change, remove or add characters, and change their order.

2) Glyph processing - This step performs character to glyph mapping,and uses the GSUB table associated with the font to perform glyph substitutions, such as ligature substitution.

3) Glyph post processing - in cases where the font doesn't directly contain a GSUB table, the previous two steps may have generated "fake" glyph indices to use with a "canned" GSUB table. This step turns those glyph indices into actual font-specific glyph indices, and may perform any other adjustments requried by the previous steps.

OpenTypeLayoutEngine will also use the font's GPOS table to apply position adjustments such as kerning and accent positioning.

See also:
LayoutEngine
Internal:
For internal use only.

Definition at line 48 of file OpenTypeLayoutEngine.h.


Constructor & Destructor Documentation

OpenTypeLayoutEngine::OpenTypeLayoutEngine const LEFontInstance   fontInstance,
le_int32    scriptCode,
le_int32    languageCode,
const GlyphSubstitutionTableHeader *    gsubTable
 

This is the main constructor.

It constructs an instance of OpenTypeLayoutEngine for a particular font, script and language. It takes the GSUB table as a parameter since LayoutEngine::layoutEngineFactory has to read the GSUB table to know that it has an OpenType font.

Parameters:
fontInstance  - the font
scriptCode  - the script
langaugeCode  - the language
gsubTable  - the GSUB table
See also:
LayoutEngine::layoutEngineFactory , ScriptAndLangaugeTags.h for script and language codes
Internal:
For internal use only.

OpenTypeLayoutEngine::OpenTypeLayoutEngine const LEFontInstance   fontInstance,
le_int32    scriptCode,
le_int32    languageCode
 

This constructor is used when the font requires a "canned" GSUB table which can't be known until after this constructor has been invoked.

Parameters:
fontInstance  - the font
scriptCode  - the script
langaugeCode  - the language
Internal:
For internal use only.

virtual OpenTypeLayoutEngine::~OpenTypeLayoutEngine   [virtual]
 

The destructor, virtual for correct polymorphic invocation.

Internal:
For internal use only.


Member Function Documentation

virtual void OpenTypeLayoutEngine::adjustGlyphPositions const LEUnicode    chars[],
le_int32    offset,
le_int32    count,
le_bool    reverse,
LEGlyphID    glyphs[],
le_int32    glyphCount,
float    positions[],
LEErrorCode   success
[protected, virtual]
 

This method uses the GPOS table, if there is one, to adjust the glyph positions.

Input parameters:

Parameters:
glyphs  - the input glyph array
glyphCount  - the number of glyphs in the glyph array
x  - the starting X position
y  - the starting Y position
Output parameters:
Parameters:
positions  - the output X and Y positions (two entries per glyph)
success  - set to an error code if the operation fails
Internal:
For internal use only.

Reimplemented from LayoutEngine.

Reimplemented in ArabicOpenTypeLayoutEngine, and UnicodeArabicOpenTypeLayoutEngine.

virtual le_int32 OpenTypeLayoutEngine::characterProcessing const LEUnicode    chars[],
le_int32    offset,
le_int32    count,
le_int32    max,
le_bool    rightToLeft,
LEUnicode *&    outChars,
le_int32 *&    charIndices,
const LETag **&    featureTags,
LEErrorCode   success
[protected, virtual]
 

This method does the OpenType character processing.

It assigns the OpenType feature tags to the characters, and may generate output characters that differ from the input charcters dueto insertions, deletions, or reorderings. In such cases, it will also generate an output character index array reflecting these changes.

Subclasses must override this method.

Input parameters:

Parameters:
chars  - the input character context
offset  - the index of the first character to process
count  - the number of characters to process
max  - the number of characters in the input context
rightToLeft  - true if the characters are in a right to left directional run
Output parameters:
Parameters:
outChars  - the output character array, if different from the input
charIndices  - the output character index array
featureTags  - the output feature tag array
success  - set to an error code if the operation fails
Returns:
the output character count (input character count if no change)
Internal:
For internal use only.

Reimplemented in ArabicOpenTypeLayoutEngine, HanOpenTypeLayoutEngine, and IndicOpenTypeLayoutEngine.

virtual le_int32 OpenTypeLayoutEngine::computeGlyphs const LEUnicode    chars[],
le_int32    offset,
le_int32    count,
le_int32    max,
le_bool    rightToLeft,
LEGlyphID *&    glyphs,
le_int32 *&    charIndices,
LEErrorCode   success
[protected, virtual]
 

This method applies the characterProcessing, glyphProcessing and glyphPostProcessing methods.

Most subclasses will not need to override this method.

Input parameters:

Parameters:
chars  - the input character context
offset  - the index of the first character to process
count  - the number of characters to process
max  - the number of characters in the input context
rightToLeft  - true if the text is in a right to left directional run
Output parameters:
Parameters:
glyphs  - the glyph index array
charIndices  - the character index array
success  - set to an error code if the operation fails
Returns:
the number of glyphs in the glyph index array
See also:
LayoutEngine::computeGlyphs
Internal:
For internal use only.

Reimplemented from LayoutEngine.

virtual UClassID OpenTypeLayoutEngine::getDynamicClassID void    const [inline, virtual]
 

ICU "poor man's RTTI", returns a UClassID for the actual class.

Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Reimplemented from LayoutEngine.

Reimplemented in ArabicOpenTypeLayoutEngine, HanOpenTypeLayoutEngine, and IndicOpenTypeLayoutEngine.

Definition at line 118 of file OpenTypeLayoutEngine.h.

LETag OpenTypeLayoutEngine::getLangSysTag le_int32    languageCode [static]
 

A convenience method used to convert the langauge code into the four byte langauge tag required by OpenType.

Parameters:
languageCode  - the language code
Returns:
the four byte language tag
Internal:
For internal use only.

LETag OpenTypeLayoutEngine::getScriptTag le_int32    scriptCode [static]
 

A convenience method used to convert the script code into the four byte script tag required by OpenType.

Parameters:
scriptCode  - the script code
Returns:
the four byte script tag
Internal:
For internal use only.

UClassID OpenTypeLayoutEngine::getStaticClassID void    [inline, static]
 

ICU "poor man's RTTI", returns a UClassID for this class.

Draft:
This API has been introduced in ICU 2.2. It is still in draft state and may be modified in a future release.

Reimplemented from LayoutEngine.

Reimplemented in ArabicOpenTypeLayoutEngine, HanOpenTypeLayoutEngine, and IndicOpenTypeLayoutEngine.

Definition at line 125 of file OpenTypeLayoutEngine.h.

Referenced by IndicOpenTypeLayoutEngine::getDynamicClassID(), HanOpenTypeLayoutEngine::getDynamicClassID(), and ArabicOpenTypeLayoutEngine::getDynamicClassID().

virtual le_int32 OpenTypeLayoutEngine::glyphPostProcessing LEGlyphID    tempGlyphs[],
le_int32    tempCharIndices[],
le_int32    tempGlyphCount,
LEGlyphID *&    glyphs,
le_int32 *&    charIndices,
LEErrorCode   success
[protected, virtual]
 

This method does any processing necessary to convert "fake" glyph indices used by the glyphProcessing method into "real" glyph indices which can be used to render the text.

Note that in some cases, such as CDAC Indic fonts, several "real" glyphs may be needed to render one "fake" glyph.

The default implementation of this method just returns the input glyph index and character index arrays, assuming that no "fake" glyph indices were needed to do GSUB processing.

Input paramters:

Parameters:
tempGlyphs  - the input "fake" glyph index array
tempCharIndices  - the input "fake" character index array
tempGlyphCount  - the number of "fake" glyph indices
Output parameters:
Parameters:
glyphs  - the output glyph index array
charIndices  - the output character index array
success  - set to an error code if the operation fails
Returns:
the number of glyph indices in the output glyph index array
Internal:
For internal use only.

Reimplemented in UnicodeArabicOpenTypeLayoutEngine.

virtual le_int32 OpenTypeLayoutEngine::glyphProcessing const LEUnicode    chars[],
le_int32    offset,
le_int32    count,
le_int32    max,
le_bool    rightToLeft,
const LETag **&    featureTags,
LEGlyphID *&    glyphs,
le_int32 *&    charIndices,
LEErrorCode   success
[protected, virtual]
 

This method does character to glyph mapping, and applies the GSUB table.

The default implementation calls mapCharsToGlyphs and then applies the GSUB table, if there is one.

Note that in the case of "canned" GSUB tables, the output glyph indices may be "fake" glyph indices that need to be converted to "real" glyph indices by the glyphPostProcessing method.

Input parameters:

Parameters:
chars  - the input character context
offset  - the index of the first character to process
count  - the number of characters to process
max  - the number of characters in the input context
rightToLeft  - true if the characters are in a right to left directional run
featureTags  - the feature tag array
Output parameters:
Parameters:
glyphs  - the output glyph index array
charIndices  - the output character index array
success  - set to an error code if the operation fails
Returns:
the number of glyphs in the output glyph index array
Note: if the character index array was already set by the characterProcessing method, this method won't change it.

Internal:
For internal use only.

Reimplemented in IndicOpenTypeLayoutEngine.

virtual void OpenTypeLayoutEngine::reset void    [protected, virtual]
 

This method frees the feature tag array so that the OpenTypeLayoutEngine can be reused for different text.

It is also called from our destructor.

Internal:
For internal use only.

Reimplemented from LayoutEngine.

void OpenTypeLayoutEngine::setScriptAndLanguageTags   [private]
 

This method is used by the constructors to convert the script and language codes to four byte tags and save them.


Member Data Documentation

const LETag* OpenTypeLayoutEngine::fFeatureOrder [protected]
 

A list of tags in the order in which the features in the font should be applied, as opposed to using the order of the lookups in the font.

Internal:
For internal use only.

Definition at line 168 of file OpenTypeLayoutEngine.h.

const LETag** OpenTypeLayoutEngine::fFeatureTags [protected]
 

An array of pointers to four byte feature tags.

Each pointer points to a list of tags, terminated by a special empty tag.

Internal:
For internal use only.

Definition at line 159 of file OpenTypeLayoutEngine.h.

const GlyphDefinitionTableHeader* OpenTypeLayoutEngine::fGDEFTable [protected]
 

The address of the GDEF table.

Internal:
For internal use only.

Definition at line 182 of file OpenTypeLayoutEngine.h.

const GlyphPositioningTableHeader* OpenTypeLayoutEngine::fGPOSTable [protected]
 

The address of the GPOS table.

Internal:
For internal use only.

Definition at line 189 of file OpenTypeLayoutEngine.h.

const GlyphSubstitutionTableHeader* OpenTypeLayoutEngine::fGSUBTable [protected]
 

The address of the GSUB table.

Internal:
For internal use only.

Definition at line 175 of file OpenTypeLayoutEngine.h.

LETag OpenTypeLayoutEngine::fLangSysTag [protected]
 

The four byte language tag.

Internal:
For internal use only.

Definition at line 213 of file OpenTypeLayoutEngine.h.

LETag OpenTypeLayoutEngine::fScriptTag [protected]
 

The four byte script tag.

Internal:
For internal use only.

Definition at line 206 of file OpenTypeLayoutEngine.h.

LEGlyphFilter* OpenTypeLayoutEngine::fSubstitutionFilter [protected]
 

An optional filter used to inhibit substitutions preformed by the GSUB table.

This is used for some "canned" GSUB tables to restrict substitutions to glyphs that are in the font.

Internal:
For internal use only.

Definition at line 199 of file OpenTypeLayoutEngine.h.

const char OpenTypeLayoutEngine::fgClassID [static, private]
 

The address of this static class variable serves as this class's ID for ICU "poor man's RTTI".

Reimplemented from LayoutEngine.

Reimplemented in ArabicOpenTypeLayoutEngine, HanOpenTypeLayoutEngine, and IndicOpenTypeLayoutEngine.

Definition at line 149 of file OpenTypeLayoutEngine.h.

const LETag OpenTypeLayoutEngine::languageTags[] [static, private]
 

The array of language tags, indexed by language code.

Definition at line 143 of file OpenTypeLayoutEngine.h.

const LETag OpenTypeLayoutEngine::scriptTags[] [static, private]
 

The array of script tags, indexed by script code.

Definition at line 138 of file OpenTypeLayoutEngine.h.


The documentation for this class was generated from the following file:
Generated on Mon Nov 24 14:36:42 2003 for ICU 2.8 by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001