#include <LEGlyphStorage.h>
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. | |
LEGlyphID & | operator[] (le_int32 glyphIndex) const |
This operator allows direct access to the glyph array using the index operator. | |
LEGlyphID * | insertGlyphs (le_int32 atIndex, le_int32 insertCount) |
Call this method to replace a single glyph in the glyph array with multiple glyphs. | |
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 . |
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.
Definition at line 34 of file LEGlyphStorage.h.
LEGlyphStorage::LEGlyphStorage | ( | ) |
Allocates an empty LEGlyphStorage
object.
You must call allocateGlyphArray, allocatePositions and allocateAuxData
to allocate the data.
LEGlyphStorage::~LEGlyphStorage | ( | ) |
void LEGlyphStorage::adjustPosition | ( | le_int32 | glyphIndex, | |
float | xAdjust, | |||
float | yAdjust, | |||
LEErrorCode & | success | |||
) |
Adjust the X, Y position for a particular glyph.
glyphIndex | the index of the glyph | |
xAdjust | the adjustment to the glyph's X position | |
yAdjust | the adjustment to the glyph's Y position | |
success | will be set to an error code if the glyph's position cannot be adjusted. |
void LEGlyphStorage::adoptAuxDataArray | ( | LEGlyphStorage & | from | ) |
Delete the auxillary data array and replace it with the one in from
.
Set the auxillary data array pointer in from
to NULL
.
from | the LEGlyphStorage object from which to get the new auxillary data array. |
void LEGlyphStorage::adoptCharIndicesArray | ( | LEGlyphStorage & | from | ) |
Delete the char indices array and replace it with the one in from
.
Set the char indices array pointer in from
to NULL
.
from | the LEGlyphStorage object from which to get the new char indices array. |
void LEGlyphStorage::adoptGlyphArray | ( | LEGlyphStorage & | from | ) |
Delete the glyph array and replace it with the one in from
.
Set the glyph array pointer in from
to NULL
.
from | the LEGlyphStorage object from which to get the new glyph array. |
void LEGlyphStorage::adoptGlyphCount | ( | le_int32 | newGlyphCount | ) |
Change the glyph count of this object to the given value.
newGlyphCount | the new glyph count. |
void LEGlyphStorage::adoptGlyphCount | ( | LEGlyphStorage & | from | ) |
Change the glyph count of this object to be the same as the one in from
.
from | the LEGlyphStorage object from which to get the new glyph count. |
void LEGlyphStorage::adoptPositionArray | ( | LEGlyphStorage & | from | ) |
Delete the position array and replace it with the one in from
.
Set the position array pointer in from
to NULL
.
from | the LEGlyphStorage object from which to get the new position array. |
le_int32 LEGlyphStorage::allocateAuxData | ( | LEErrorCode & | success | ) |
This method allocates the storage for the auxillary glyph data.
success | set to an error code if the aulillary data array cannot be allocated. |
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.
initialGlyphCount | the initial size of the glyph and char indices arrays. | |
rightToLeft | true if the original input text is right to left. | |
success | set to an error code if the storage cannot be allocated of if the initial glyph count is not positive. |
le_int32 LEGlyphStorage::allocatePositions | ( | LEErrorCode & | success | ) |
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.
success | set to an error code if the positions array cannot be allocated. |
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.
atPosition | the position of the insertion | |
count | the number of glyphs being inserted | |
newGlyphs | the address of the new glyph IDs |
true
if LEInsertionList
should stop processing the insertion list after this insertion.le_int32 LEGlyphStorage::applyInsertions | ( | ) |
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.
le_uint32 LEGlyphStorage::getAuxData | ( | le_int32 | glyphIndex, | |
LEErrorCode & | success | |||
) | const |
Get the auxillary data for a particular glyph.
glyphIndex | the index into the glyph array | |
success | set to an error code if the auxillary data cannot be retrieved. |
void LEGlyphStorage::getAuxData | ( | le_uint32 | auxData[], | |
LEErrorCode & | success | |||
) | const |
Copy the entire auxillary data array.
auxData | the auxillary data array will be copied to this address | |
success | set to an error code if the data cannot be copied |
le_int32 LEGlyphStorage::getCharIndex | ( | le_int32 | glyphIndex, | |
LEErrorCode & | success | |||
) | const |
Get the char index for a particular glyph.
glyphIndex | the index into the glyph array | |
success | set to an error code if the char index cannot be retrieved. |
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.
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 |
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.
charIndices | - the destiniation character index array | |
success | - set to an error code if the operation fails |
virtual UClassID LEGlyphStorage::getDynamicClassID | ( | ) | const [virtual] |
le_int32 LEGlyphStorage::getGlyphCount | ( | ) | const [inline] |
This method returns the number of glyphs in the glyph array.
Definition at line 497 of file LEGlyphStorage.h.
LEGlyphID LEGlyphStorage::getGlyphID | ( | le_int32 | glyphIndex, | |
LEErrorCode & | success | |||
) | const |
Get the glyph ID for a particular glyph.
glyphIndex | the index into the glyph array | |
success | set to an error code if the glyph ID cannot be retrieved. |
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:
glyphIndex | - the index of the glyph |
x | - the glyph's X position | |
y | - the glyph's Y position | |
success | - set to an error code if the operation fails |
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.
positions | - the destiniation position array | |
success | - set to an error code if the operation fails |
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)
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 |
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.
glyphs | - the destiniation glyph array | |
success | - set to an error code if the operation fails |
static UClassID LEGlyphStorage::getStaticClassID | ( | ) | [static] |
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.
atIndex | the index of the glyph to be replaced | |
insertCount | the number of glyphs to replace it with |
This operator allows direct access to the glyph array using the index operator.
glyphIndex | the index into the glyph array |
Definition at line 502 of file LEGlyphStorage.h.
void LEGlyphStorage::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.
(This method is also called by the destructor)
void LEGlyphStorage::setAuxData | ( | le_int32 | glyphIndex, | |
le_uint32 | auxData, | |||
LEErrorCode & | success | |||
) |
Set the auxillary data for a particular glyph.
glyphIndex | the index of the glyph | |
auxData | the new auxillary data | |
success | will be set to an error code if the auxillary data cannot be set. |
void LEGlyphStorage::setCharIndex | ( | le_int32 | glyphIndex, | |
le_int32 | charIndex, | |||
LEErrorCode & | success | |||
) |
Set the char index for a particular glyph.
glyphIndex | the index of the glyph | |
charIndex | the new char index | |
success | will be set to an error code if the char index cannot be set. |
void LEGlyphStorage::setGlyphID | ( | le_int32 | glyphIndex, | |
LEGlyphID | glyphID, | |||
LEErrorCode & | success | |||
) |
Set the glyph ID for a particular glyph.
glyphIndex | the index of the glyph | |
glyphID | the new glyph ID | |
success | will be set to an error code if the glyph ID cannot be set. |
void LEGlyphStorage::setPosition | ( | le_int32 | glyphIndex, | |
float | x, | |||
float | y, | |||
LEErrorCode & | success | |||
) |
Set the X, Y position for a particular glyph.
glyphIndex | the index of the glyph | |
x | the new X position | |
y | the new Y position | |
success | will be set to an error code if the position cannot be set. |