diff -ru icu.orig/source/layout/IndicReordering.cpp icu/source/layout/IndicReordering.cpp --- icu.orig/source/layout/IndicReordering.cpp 2006-10-03 13:41:18.000000000 +0100 +++ icu/source/layout/IndicReordering.cpp 2006-10-03 13:54:11.000000000 +0100 @@ -50,6 +50,14 @@ #define distFeatureMask 0x00010000UL #define initFeatureMask 0x00008000UL +// TODO: Find better names for these! +#define tagArray4 (loclFeatureMask | nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask) +#define tagArray3 (pstfFeatureMask | tagArray4) +#define tagArray2 (halfFeatureMask | tagArray3) +#define tagArray1 (blwfFeatureMask | tagArray2) +#define tagArray0 (rphfFeatureMask | tagArray1) + + class IndicReorderingOutput : public UMemory { private: le_int32 fOutIndex; @@ -154,6 +162,27 @@ fSMabove = fSMbelow = 0; } + void swapChars(int a, int b) + { + LEErrorCode success = LE_NO_ERROR; + LEUnicode temp_char; + le_uint32 temp_index; + FeatureMask temp_tag; + + temp_char = fOutChars[fOutIndex + b]; + temp_index = fGlyphStorage.getCharIndex(fOutIndex + b, success); + temp_tag = fGlyphStorage.getAuxData(fOutIndex + b, success); + + fOutChars[fOutIndex + b] = fOutChars[fOutIndex + a]; + le_uint32 toswap = fGlyphStorage.getCharIndex(fOutIndex + a, success); + fGlyphStorage.setCharIndex(fOutIndex + b, toswap, success); + fGlyphStorage.setAuxData(fOutIndex + b, tagArray3, success); + + fOutChars[fOutIndex + a] = temp_char; + fGlyphStorage.setCharIndex(fOutIndex + a, temp_index, success); + fGlyphStorage.setAuxData(fOutIndex + a, temp_tag, success); + } + void writeChar(LEUnicode ch, le_uint32 charIndex, FeatureMask charFeatures) { LEErrorCode success = LE_NO_ERROR; @@ -335,13 +364,6 @@ C_DOTTED_CIRCLE = 0x25CC }; -// TODO: Find better names for these! -#define tagArray4 (loclFeatureMask | nuktFeatureMask | akhnFeatureMask | vatuFeatureMask | presFeatureMask | blwsFeatureMask | abvsFeatureMask | pstsFeatureMask | halnFeatureMask | blwmFeatureMask | abvmFeatureMask | distFeatureMask) -#define tagArray3 (pstfFeatureMask | tagArray4) -#define tagArray2 (halfFeatureMask | tagArray3) -#define tagArray1 (blwfFeatureMask | tagArray2) -#define tagArray0 (rphfFeatureMask | tagArray1) - static const FeatureMap featureMap[] = { {loclFeatureTag, loclFeatureMask}, @@ -629,6 +651,15 @@ output.writeChar(chars[i], i, tagArray4); } + /* for the special conjuction of Cons+0x0d4d+0x0d31 of Malayalam */ + if ((baseConsonant - 2 >= 0) && + (chars[baseConsonant - 1] == 0x0d4d) && + (chars[baseConsonant] == 0x0d31) && + ((chars[baseConsonant - 2] >= 0x0d15) && + (chars[baseConsonant - 2] <= 0x0d39))) { + output.swapChars(-1, -3); + } + if ((classTable->scriptFlags & SF_MATRAS_AFTER_BASE) != 0) { output.writeMbelow(); output.writeSMbelow(); // FIXME: there are no SMs in these scripts...