void IndicReordering::finalReordering(LEGlyphStorage &glyphStorage, le_int32 count) { LEErrorCode success = LE_NO_ERROR; // Reposition REPH as appropriate for ( le_int32 i = 0 ; i < count ; i++ ) { le_int32 tmpAuxData = glyphStorage.getAuxData(i,success); LEGlyphID tmpGlyph = glyphStorage.getGlyphID(i,success); if ( ( tmpGlyph != NO_GLYPH ) && (tmpAuxData & rephConsonantMask) && !(tmpAuxData & repositionedGlyphMask)) { le_bool targetPositionFound = false; le_int32 targetPosition = i+1; le_int32 baseConsonantData; while (!targetPositionFound) { tmpGlyph = glyphStorage.getGlyphID(targetPosition,success); tmpAuxData = glyphStorage.getAuxData(targetPosition,success); if ( tmpAuxData & baseConsonantMask ) { baseConsonantData = tmpAuxData; targetPositionFound = true; } else { targetPosition++; } } // Make sure we are not putting the reph into an empty hole le_bool targetPositionHasGlyph = false; while (!targetPositionHasGlyph) { tmpGlyph = glyphStorage.getGlyphID(targetPosition,success); if ( tmpGlyph != NO_GLYPH ) { targetPositionHasGlyph = true; } else { targetPosition--; } } // Make sure that REPH is positioned after any above base or post base matras // le_bool checkMatraDone = false; le_int32 checkMatraPosition = targetPosition+1; while ( !checkMatraDone ) { tmpAuxData = glyphStorage.getAuxData(checkMatraPosition,success); if ( checkMatraPosition >= count || ( (tmpAuxData ^ baseConsonantData) & LE_GLYPH_GROUP_MASK)) { checkMatraDone = true; continue; } if ( (tmpAuxData & matraMask) && (((tmpAuxData & markPositionMask) == aboveBasePosition) || ((tmpAuxData & markPositionMask) == postBasePosition))) { targetPosition = checkMatraPosition; } checkMatraPosition++; } glyphStorage.moveGlyph(i,targetPosition,repositionedGlyphMask); } } }