X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/46f4442e9a5a4f3b98b7c1083586332f6a8a99a4..38fbf2fd31f5cd99b500914d6037b1d06b608645:/icuSources/layout/ArabicShaping.cpp diff --git a/icuSources/layout/ArabicShaping.cpp b/icuSources/layout/ArabicShaping.cpp index d2859b45..7399102e 100644 --- a/icuSources/layout/ArabicShaping.cpp +++ b/icuSources/layout/ArabicShaping.cpp @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. 1998-2008 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2013 - All Rights Reserved * */ @@ -27,20 +27,22 @@ const ArabicShaping::ShapeType ArabicShaping::shapeTypes[] = /* shaping array holds types for Arabic chars between 0610 and 0700 other values are either unshaped, or transparent if a mark or format - code, except for format codes 200c (zero-width non-joiner) and 200d + code, except for format codes 200c (zero-width non-joiner) and 200d (dual-width joiner) which are both unshaped and non_joining or dual-joining, respectively. */ ArabicShaping::ShapeType ArabicShaping::getShapeType(LEUnicode c) { - const ClassDefinitionTable *joiningTypes = (const ClassDefinitionTable *) ArabicShaping::shapingTypeTable; - le_int32 joiningType = joiningTypes->getGlyphClass(c); + LEErrorCode success = LE_NO_ERROR; + const LEReferenceTo joiningTypes((const ClassDefinitionTable *) ArabicShaping::shapingTypeTable, + ArabicShaping::shapingTypeTableLen); + le_int32 joiningType = joiningTypes->getGlyphClass(joiningTypes, c, success); - if (joiningType >= 0 && joiningType < ArabicShaping::JT_COUNT) { - return ArabicShaping::shapeTypes[joiningType]; - } + if (joiningType >= 0 && joiningType < ArabicShaping::JT_COUNT && LE_SUCCESS(success)) { + return ArabicShaping::shapeTypes[joiningType]; + } - return ArabicShaping::ST_NOSHAPE_NONE; + return ArabicShaping::ST_NOSHAPE_NONE; } #define isolFeatureTag LE_ISOL_FEATURE_TAG @@ -124,8 +126,8 @@ void ArabicShaping::shape(const LEUnicode *chars, le_int32 offset, le_int32 char le_bool rightToLeft, LEGlyphStorage &glyphStorage) { // iterate in logical order, store tags in visible order - // - // the effective right char is the most recently encountered + // + // the effective right char is the most recently encountered // non-transparent char // // four boolean states: @@ -133,7 +135,7 @@ void ArabicShaping::shape(const LEUnicode *chars, le_int32 offset, le_int32 char // the effective right char causes left shaping // the current char shapes // the current char causes right shaping - // + // // if both cause shaping, then // shaper.shape(errout, 2) (isolate to initial, or final to medial) // shaper.shape(out, 1) (isolate to final) @@ -144,7 +146,7 @@ void ArabicShaping::shape(const LEUnicode *chars, le_int32 offset, le_int32 char for (i = offset - 1; i >= 0; i -= 1) { rightType = getShapeType(chars[i]); - + if (rightType != ST_TRANSPARENT) { break; }