X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..6de34a005df0e4a02d88750703b950237b77d9c8:/icuSources/layout/IndicLayoutEngine.cpp?ds=sidebyside diff --git a/icuSources/layout/IndicLayoutEngine.cpp b/icuSources/layout/IndicLayoutEngine.cpp index 92f53541..3b776a0d 100644 --- a/icuSources/layout/IndicLayoutEngine.cpp +++ b/icuSources/layout/IndicLayoutEngine.cpp @@ -1,8 +1,7 @@ /* - * @(#)IndicLayoutEngine.cpp 1.3 00/03/15 * - * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2004 - All Rights Reserved * */ @@ -17,12 +16,13 @@ #include "GlyphPositioningTables.h" #include "GDEFMarkFilter.h" +#include "LEGlyphStorage.h" #include "IndicReordering.h" U_NAMESPACE_BEGIN -const char IndicOpenTypeLayoutEngine::fgClassID=0; +UOBJECT_DEFINE_RTTI_IMPLEMENTATION(IndicOpenTypeLayoutEngine) IndicOpenTypeLayoutEngine::IndicOpenTypeLayoutEngine(const LEFontInstance *fontInstance, le_int32 scriptCode, le_int32 languageCode, const GlyphSubstitutionTableHeader *gsubTable) @@ -44,8 +44,8 @@ IndicOpenTypeLayoutEngine::~IndicOpenTypeLayoutEngine() // Input: characters, tags // Output: glyphs, char indices -le_int32 IndicOpenTypeLayoutEngine::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) +le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -56,13 +56,13 @@ le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_ return 0; } - le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, rightToLeft, featureTags, glyphs, charIndices, success); + le_int32 retCount = OpenTypeLayoutEngine::glyphProcessing(chars, offset, count, max, rightToLeft, glyphStorage, success); if (LE_FAILURE(success)) { return 0; } - IndicReordering::adjustMPres(fMPreFixups, glyphs, charIndices); + IndicReordering::adjustMPres(fMPreFixups, glyphStorage); return retCount; } @@ -70,8 +70,8 @@ le_int32 IndicOpenTypeLayoutEngine::glyphProcessing(const LEUnicode chars[], le_ // Input: characters // Output: characters, char indices, tags // Returns: output character count -le_int32 IndicOpenTypeLayoutEngine::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) +le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], le_int32 offset, le_int32 count, le_int32 max, le_bool rightToLeft, + LEUnicode *&outChars, LEGlyphStorage &glyphStorage, LEErrorCode &success) { if (LE_FAILURE(success)) { return 0; @@ -91,25 +91,20 @@ le_int32 IndicOpenTypeLayoutEngine::characterProcessing(const LEUnicode chars[], return 0; } - charIndices = LE_NEW_ARRAY(le_int32, worstCase); - if (charIndices == NULL) { - LE_DELETE_ARRAY(outChars); - success = LE_MEMORY_ALLOCATION_ERROR; - return 0; - } + glyphStorage.allocateGlyphArray(worstCase, rightToLeft, success); + glyphStorage.allocateAuxData(success); - featureTags = LE_NEW_ARRAY(const LETag *, worstCase); - - if (featureTags == NULL) { - LE_DELETE_ARRAY(charIndices); + if (LE_FAILURE(success)) { LE_DELETE_ARRAY(outChars); - success = LE_MEMORY_ALLOCATION_ERROR; return 0; } // NOTE: assumes this allocates featureTags... // (probably better than doing the worst case stuff here...) - return IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, charIndices, featureTags, &fMPreFixups); + le_int32 outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups); + + glyphStorage.adoptGlyphCount(outCharCount); + return outCharCount; } U_NAMESPACE_END