Logo Search packages:      
Sourcecode: icu version File versions  Download package

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:
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.
ICU 3.0

Definition at line 65 of file LEGlyphStorage.cpp.

References fCharIndices, fGlyphCount, fGlyphs, fInsertionList, LE_FAILURE, LE_ILLEGAL_ARGUMENT_ERROR, LE_MEMORY_ALLOCATION_ERROR, and NULL.

Referenced by TibetanOpenTypeLayoutEngine::characterProcessing(), OpenTypeLayoutEngine::characterProcessing(), LayoutEngine::characterProcessing(), KhmerOpenTypeLayoutEngine::characterProcessing(), IndicOpenTypeLayoutEngine::characterProcessing(), HanOpenTypeLayoutEngine::characterProcessing(), HangulOpenTypeLayoutEngine::characterProcessing(), ArabicOpenTypeLayoutEngine::characterProcessing(), ThaiLayoutEngine::computeGlyphs(), LayoutEngine::mapCharsToGlyphs(), and UnicodeArabicOpenTypeLayoutEngine::mapCharsToGlyphs().

{
    if (LE_FAILURE(success)) {
        return;
    }

    if (initialGlyphCount <= 0) {
        success = LE_ILLEGAL_ARGUMENT_ERROR;
        return;
    }

    if (fGlyphs == NULL) {
        fGlyphCount = initialGlyphCount;
        fGlyphs = LE_NEW_ARRAY(LEGlyphID, fGlyphCount);

        if (fGlyphs == NULL) {
            success = LE_MEMORY_ALLOCATION_ERROR;
            return;
        }
    }

    if (fCharIndices == NULL) {
        fCharIndices = LE_NEW_ARRAY(le_int32, fGlyphCount);

        if (fCharIndices == NULL) {
            LE_DELETE_ARRAY(fGlyphs);
            fGlyphs = NULL;
            success = LE_MEMORY_ALLOCATION_ERROR;
            return;
        }

        // Initialize the charIndices array
        le_int32 i, count = fGlyphCount, dir = 1, out = 0;

        if (rightToLeft) {
            out = fGlyphCount - 1;
            dir = -1;
        }

        for (i = 0; i < count; i += 1, out += dir) {
            fCharIndices[out] = i;
        }
    }

    if (fInsertionList == NULL) {
        // FIXME: check this for failure?
        fInsertionList = new LEInsertionList(rightToLeft);
        if (fInsertionList == NULL) { 
            LE_DELETE_ARRAY(fCharIndices);
            fCharIndices = NULL;

            LE_DELETE_ARRAY(fGlyphs);
            fGlyphs = NULL;

            success = LE_MEMORY_ALLOCATION_ERROR;
            return;
        }
    }
}


Generated by  Doxygen 1.6.0   Back to index