ICU 4.8.1.1  4.8.1.1
Public Member Functions | Static Public Member Functions | Protected Member Functions
LEGlyphStorage Class Reference

This class encapsulates the per-glyph storage used by the ICU LayoutEngine. More...

#include <LEGlyphStorage.h>

Inheritance diagram for LEGlyphStorage:
UObject UMemory

Public Member Functions

 LEGlyphStorage ()
 Allocates an empty LEGlyphStorage object.
 ~LEGlyphStorage ()
 The destructor.
le_int32 getGlyphCount () const
 This method returns the number of glyphs in the glyph array.
void getGlyphs (LEGlyphID glyphs[], LEErrorCode &success) const
 This method copies the glyph array into a caller supplied array.
void getGlyphs (le_uint32 glyphs[], le_uint32 extraBits, LEErrorCode &success) const
 This method copies the glyph array into a caller supplied array, ORing in extra bits.
void getCharIndices (le_int32 charIndices[], LEErrorCode &success) const
 This method copies the character index array into a caller supplied array.
void getCharIndices (le_int32 charIndices[], le_int32 indexBase, LEErrorCode &success) const
 This method copies the character index array into a caller supplied array.
void getGlyphPositions (float positions[], LEErrorCode &success) const
 This method copies the position array into a caller supplied array.
void getGlyphPosition (le_int32 glyphIndex, float &x, float &y, LEErrorCode &success) const
 This method returns the X and Y position of the glyph at the given index.
void allocateGlyphArray (le_int32 initialGlyphCount, le_bool rightToLeft, LEErrorCode &success)
 This method allocates the glyph array, the char indices array and the insertion list.
le_int32 allocatePositions (LEErrorCode &success)
 This method allocates the storage for the glyph positions.
le_int32 allocateAuxData (LEErrorCode &success)
 This method allocates the storage for the auxillary glyph data.
void getAuxData (le_uint32 auxData[], LEErrorCode &success) const
 Copy the entire auxillary data array.
LEGlyphID getGlyphID (le_int32 glyphIndex, LEErrorCode &success) const
 Get the glyph ID for a particular glyph.
le_int32 getCharIndex (le_int32 glyphIndex, LEErrorCode &success) const
 Get the char index for a particular glyph.
le_uint32 getAuxData (le_int32 glyphIndex, LEErrorCode &success) const
 Get the auxillary data for a particular glyph.
LEGlyphIDoperator[] (le_int32 glyphIndex) const
 This operator allows direct access to the glyph array using the index operator.
LEGlyphIDinsertGlyphs (le_int32 atIndex, le_int32 insertCount, LEErrorCode &success)
 Call this method to replace a single glyph in the glyph array with multiple glyphs.
LEGlyphIDinsertGlyphs (le_int32 atIndex, le_int32 insertCount)
 Call this method to replace a single glyph in the glyph array with multiple glyphs.
void moveGlyph (le_int32 fromPosition, le_int32 toPosition, le_uint32 marker)
 This method is used to reposition glyphs during Indic v2 processing.
le_int32 applyInsertions ()
 This method causes all of the glyph insertions recorded by insertGlyphs to be applied to the glyph array.
void setGlyphID (le_int32 glyphIndex, LEGlyphID glyphID, LEErrorCode &success)
 Set the glyph ID for a particular glyph.
void setCharIndex (le_int32 glyphIndex, le_int32 charIndex, LEErrorCode &success)
 Set the char index for a particular glyph.
void setPosition (le_int32 glyphIndex, float x, float y, LEErrorCode &success)
 Set the X, Y position for a particular glyph.
void adjustPosition (le_int32 glyphIndex, float xAdjust, float yAdjust, LEErrorCode &success)
 Adjust the X, Y position for a particular glyph.
void setAuxData (le_int32 glyphIndex, le_uint32 auxData, LEErrorCode &success)
 Set the auxillary data for a particular glyph.
void adoptGlyphArray (LEGlyphStorage &from)
 Delete the glyph array and replace it with the one in from.
void adoptCharIndicesArray (LEGlyphStorage &from)
 Delete the char indices array and replace it with the one in from.
void adoptPositionArray (LEGlyphStorage &from)
 Delete the position array and replace it with the one in from.
void adoptAuxDataArray (LEGlyphStorage &from)
 Delete the auxillary data array and replace it with the one in from.
void adoptGlyphCount (LEGlyphStorage &from)
 Change the glyph count of this object to be the same as the one in from.
void adoptGlyphCount (le_int32 newGlyphCount)
 Change the glyph count of this object to the given value.
void reset ()
 This method frees the glyph, character index, position and auxillary data arrays so that the LayoutEngine can be reused to layout a different characer array.
virtual UClassID getDynamicClassID () const
 ICU "poor man's RTTI", returns a UClassID for the actual class.

Static Public Member Functions

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

Protected Member Functions

virtual le_bool applyInsertion (le_int32 atPosition, le_int32 count, LEGlyphID newGlyphs[])
 This implements LEInsertionCallback.

Detailed Description

This class encapsulates the per-glyph storage used by the ICU LayoutEngine.

For each glyph it holds the glyph ID, the index of the backing store character which produced the glyph, the X and Y position of the glyph and an auxillary data pointer.

The storage is growable using the LEInsertionList class.

See also:
LEInsertionList.h
Stable:
ICU 3.6

Definition at line 34 of file LEGlyphStorage.h.


Constructor & Destructor Documentation

Allocates an empty LEGlyphStorage object.

You must call allocateGlyphArray, allocatePositions and allocateAuxData to allocate the data.

Stable:
ICU 3.0

The destructor.

This will deallocate all of the arrays.

Stable:
ICU 3.0

Member Function Documentation

void LEGlyphStorage::adjustPosition ( le_int32  glyphIndex,
float  xAdjust,
float  yAdjust,
LEErrorCode success 
)

Adjust the X, Y position for a particular glyph.

Parameters:
glyphIndexthe index of the glyph
xAdjustthe adjustment to the glyph's X position
yAdjustthe adjustment to the glyph's Y position
successwill be set to an error code if the glyph's position cannot be adjusted.
Stable:
ICU 3.0

Delete the auxillary data array and replace it with the one in from.

Set the auxillary data array pointer in from to NULL.

Parameters:
fromthe LEGlyphStorage object from which to get the new auxillary data array.
Stable:
ICU 3.0

Delete the char indices array and replace it with the one in from.

Set the char indices array pointer in from to NULL.

Parameters:
fromthe LEGlyphStorage object from which to get the new char indices array.
Stable:
ICU 3.0

Delete the glyph array and replace it with the one in from.

Set the glyph array pointer in from to NULL.

Parameters:
fromthe LEGlyphStorage object from which to get the new glyph array.
Stable:
ICU 3.0

Change the glyph count of this object to be the same as the one in from.

Parameters:
fromthe LEGlyphStorage object from which to get the new glyph count.
Stable:
ICU 3.0
void LEGlyphStorage::adoptGlyphCount ( le_int32  newGlyphCount)

Change the glyph count of this object to the given value.

Parameters:
newGlyphCountthe new glyph count.
Stable:
ICU 3.0

Delete the position array and replace it with the one in from.

Set the position array pointer in from to NULL.

Parameters:
fromthe LEGlyphStorage object from which to get the new position array.
Stable:
ICU 3.0

This method allocates the storage for the auxillary glyph data.

Parameters:
successset to an error code if the aulillary data array cannot be allocated.
Returns:
the size of the auxillary data array.
Stable:
ICU 3.6
void LEGlyphStorage::allocateGlyphArray ( le_int32  initialGlyphCount,
le_bool  rightToLeft,
LEErrorCode success 
)

This method allocates the glyph array, the char indices array and the insertion list.

You must call this method before using the object. This method also initializes the char indices array.

Parameters:
initialGlyphCountthe initial size of the glyph and char indices arrays.
rightToLefttrue if the original input text is right to left.
successset to an error code if the storage cannot be allocated of if the initial glyph count is not positive.
Stable:
ICU 3.0

This method allocates the storage for the glyph positions.

It allocates one extra X, Y position pair for the position just after the last glyph.

Parameters:
successset to an error code if the positions array cannot be allocated.
Returns:
the number of X, Y position pairs allocated.
Stable:
ICU 3.0
virtual le_bool LEGlyphStorage::applyInsertion ( le_int32  atPosition,
le_int32  count,
LEGlyphID  newGlyphs[] 
) [protected, virtual]

This implements LEInsertionCallback.

The LEInsertionList will call this method once for each insertion.

Parameters:
atPositionthe position of the insertion
countthe number of glyphs being inserted
newGlyphsthe address of the new glyph IDs
Returns:
true if LEInsertionList should stop processing the insertion list after this insertion.
See also:
LEInsertionList.h
Stable:
ICU 3.0

This method causes all of the glyph insertions recorded by insertGlyphs to be applied to the glyph array.

The new slots in the char indices and the auxillary data arrays will be filled in with the values for the glyph being replaced.

Returns:
the new size of the glyph array
See also:
LEInsertionList.h
Stable:
ICU 3.0
void LEGlyphStorage::getAuxData ( le_uint32  auxData[],
LEErrorCode success 
) const

Copy the entire auxillary data array.

Parameters:
auxDatathe auxillary data array will be copied to this address
successset to an error code if the data cannot be copied
Stable:
ICU 3.6
le_uint32 LEGlyphStorage::getAuxData ( le_int32  glyphIndex,
LEErrorCode success 
) const

Get the auxillary data for a particular glyph.

Parameters:
glyphIndexthe index into the glyph array
successset to an error code if the auxillary data cannot be retrieved.
Returns:
the auxillary data
Stable:
ICU 3.6
le_int32 LEGlyphStorage::getCharIndex ( le_int32  glyphIndex,
LEErrorCode success 
) const

Get the char index for a particular glyph.

Parameters:
glyphIndexthe index into the glyph array
successset to an error code if the char index cannot be retrieved.
Returns:
the character index
Stable:
ICU 3.0
void LEGlyphStorage::getCharIndices ( le_int32  charIndices[],
LEErrorCode success 
) const

This method copies the character index array into a caller supplied array.

The caller must ensure that the array is large enough to hold a character index for each glyph.

Parameters:
charIndices- the destiniation character index array
success- set to an error code if the operation fails
Stable:
ICU 3.0
void LEGlyphStorage::getCharIndices ( le_int32  charIndices[],
le_int32  indexBase,
LEErrorCode success 
) const

This method copies the character index array into a caller supplied array.

The caller must ensure that the array is large enough to hold a character index for each glyph.

Parameters:
charIndices- the destiniation character index array
indexBase- an offset which will be added to each index
success- set to an error code if the operation fails
Stable:
ICU 3.0
virtual UClassID LEGlyphStorage::getDynamicClassID ( ) const [virtual]

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

Stable:
ICU 3.0

Implements UObject.

This method returns the number of glyphs in the glyph array.

Returns:
the number of glyphs in the glyph array
Stable:
ICU 3.0

Definition at line 533 of file LEGlyphStorage.h.

LEGlyphID LEGlyphStorage::getGlyphID ( le_int32  glyphIndex,
LEErrorCode success 
) const

Get the glyph ID for a particular glyph.

Parameters:
glyphIndexthe index into the glyph array
successset to an error code if the glyph ID cannot be retrieved.
Returns:
the glyph ID
Stable:
ICU 3.0
void LEGlyphStorage::getGlyphPosition ( le_int32  glyphIndex,
float &  x,
float &  y,
LEErrorCode success 
) const

This method returns the X and Y position of the glyph at the given index.

Input parameters:

Parameters:
glyphIndex- the index of the glyph

Output parameters:

Parameters:
x- the glyph's X position
y- the glyph's Y position
success- set to an error code if the operation fails
Stable:
ICU 3.0
void LEGlyphStorage::getGlyphPositions ( float  positions[],
LEErrorCode success 
) const

This method copies the position array into a caller supplied array.

The caller must ensure that the array is large enough to hold an X and Y position for each glyph, plus an extra X and Y for the advance of the last glyph.

Parameters:
positions- the destiniation position array
success- set to an error code if the operation fails
Stable:
ICU 3.0
void LEGlyphStorage::getGlyphs ( LEGlyphID  glyphs[],
LEErrorCode success 
) const

This method copies the glyph array into a caller supplied array.

The caller must ensure that the array is large enough to hold all the glyphs.

Parameters:
glyphs- the destiniation glyph array
success- set to an error code if the operation fails
Stable:
ICU 3.0
void LEGlyphStorage::getGlyphs ( le_uint32  glyphs[],
le_uint32  extraBits,
LEErrorCode success 
) const

This method copies the glyph array into a caller supplied array, ORing in extra bits.

(This functionality is needed by the JDK, which uses 32 bits pre glyph idex, with the high 16 bits encoding the composite font slot number)

Parameters:
glyphs- the destination (32 bit) glyph array
extraBits- this value will be ORed with each glyph index
success- set to an error code if the operation fails
Stable:
ICU 3.0

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

Stable:
ICU 3.0
LEGlyphID* LEGlyphStorage::insertGlyphs ( le_int32  atIndex,
le_int32  insertCount,
LEErrorCode success 
)

Call this method to replace a single glyph in the glyph array with multiple glyphs.

This method uses the LEInsertionList to do the insertion. It returns the address of storage where the new glyph IDs can be stored. They will not actually be inserted into the glyph array until applyInsertions is called.

Parameters:
atIndexthe index of the glyph to be replaced
insertCountthe number of glyphs to replace it with
successset to an error code if the auxillary data cannot be retrieved.
Returns:
the address at which to store the replacement glyphs.
See also:
LEInsertionList.h
Stable:
ICU 4.2
LEGlyphID* LEGlyphStorage::insertGlyphs ( le_int32  atIndex,
le_int32  insertCount 
)

Call this method to replace a single glyph in the glyph array with multiple glyphs.

This method uses the LEInsertionList to do the insertion. It returns the address of storage where the new glyph IDs can be stored. They will not actually be inserted into the glyph array until applyInsertions is called.

Note: Don't use this version, use the other version of this function which has an error code.

Parameters:
atIndexthe index of the glyph to be replaced
insertCountthe number of glyphs to replace it with
Returns:
the address at which to store the replacement glyphs.
See also:
LEInsertionList.h
Stable:
ICU 3.0
void LEGlyphStorage::moveGlyph ( le_int32  fromPosition,
le_int32  toPosition,
le_uint32  marker 
)

This method is used to reposition glyphs during Indic v2 processing.

It moves all of the relevant glyph information ( glyph, indices, positions, and auxData ), from the source position to the target position, and also allows for a marker bit to be set in the target glyph's auxData so that it won't be reprocessed later in the cycle.

Parameters:
fromPosition- position of the glyph to be moved
toPosition- target position of the glyph
markermarker bit
Stable:
ICU 4.2
LEGlyphID & LEGlyphStorage::operator[] ( le_int32  glyphIndex) const [inline]

This operator allows direct access to the glyph array using the index operator.

Parameters:
glyphIndexthe index into the glyph array
Returns:
a reference to the given location in the glyph array
Stable:
ICU 3.0

Definition at line 538 of file LEGlyphStorage.h.

This method frees the glyph, character index, position and auxillary data arrays so that the LayoutEngine can be reused to layout a different characer array.

(This method is also called by the destructor)

Stable:
ICU 3.0
void LEGlyphStorage::setAuxData ( le_int32  glyphIndex,
le_uint32  auxData,
LEErrorCode success 
)

Set the auxillary data for a particular glyph.

Parameters:
glyphIndexthe index of the glyph
auxDatathe new auxillary data
successwill be set to an error code if the auxillary data cannot be set.
Stable:
ICU 3.6
void LEGlyphStorage::setCharIndex ( le_int32  glyphIndex,
le_int32  charIndex,
LEErrorCode success 
)

Set the char index for a particular glyph.

Parameters:
glyphIndexthe index of the glyph
charIndexthe new char index
successwill be set to an error code if the char index cannot be set.
Stable:
ICU 3.0
void LEGlyphStorage::setGlyphID ( le_int32  glyphIndex,
LEGlyphID  glyphID,
LEErrorCode success 
)

Set the glyph ID for a particular glyph.

Parameters:
glyphIndexthe index of the glyph
glyphIDthe new glyph ID
successwill be set to an error code if the glyph ID cannot be set.
Stable:
ICU 3.0
void LEGlyphStorage::setPosition ( le_int32  glyphIndex,
float  x,
float  y,
LEErrorCode success 
)

Set the X, Y position for a particular glyph.

Parameters:
glyphIndexthe index of the glyph
xthe new X position
ythe new Y position
successwill be set to an error code if the position cannot be set.
Stable:
ICU 3.0

The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines