private int calculateSize(char[] source,
                              int sourceStart,
                              int sourceLength) {

        int destSize = sourceLength;

        switch (options & LETTERS_MASK) {
        case LETTERS_SHAPE:
        case LETTERS_SHAPE_TASHKEEL_ISOLATED:
            if (isLogical) {
                for (int i = sourceStart, e = sourceStart + sourceLength - 1; i < e; ++i) {
                    if ((source[i] == LAM_CHAR && isAlefChar(source[i+1])) || isTashkeelCharFE(source[i])){
                        --destSize;
                    }
                }
            } else { // visual
                for(int i = sourceStart + 1, e = sourceStart + sourceLength; i < e; ++i) {
                    if ((source[i] == LAM_CHAR && isAlefChar(source[i-1])) || isTashkeelCharFE(source[i])) {
                        --destSize;
                    }
                }
            }
            break;

        case LETTERS_UNSHAPE:
            for(int i = sourceStart, e = sourceStart + sourceLength; i < e; ++i) {
                if (isLamAlefChar(source[i])) {
                    destSize++;
                }
            }
            break;

        default:
            break;
        }

        return destSize;
    }
private int calculateSize ( char [ ] source , int sourceStart , int sourceLength ) { int destSize = sourceLength ; switch ( options & LETTERS_MASK ) { case LETTERS_SHAPE : case LETTERS_SHAPE_TASHKEEL_ISOLATED : if ( isLogical ) { for ( int i = sourceStart , e = sourceStart + sourceLength - 1 ; i < e ; ++ i ) { if ( ( source [ i ] == LAM_CHAR && isAlefChar ( source [ i + 1 ] ) ) || isTashkeelCharFE ( source [ i ] ) ) { -- destSize ; } } } else { for ( int i = sourceStart + 1 , e = sourceStart + sourceLength ; i < e ; ++ i ) { if ( ( source [ i ] == LAM_CHAR && isAlefChar ( source [ i - 1 ] ) ) || isTashkeelCharFE ( source [ i ] ) ) { -- destSize ; } } } break ; case LETTERS_UNSHAPE : for ( int i = sourceStart , e = sourceStart + sourceLength ; i < e ; ++ i ) { if ( isLamAlefChar ( source [ i ] ) ) { destSize ++ ; } } break ; default : break ; } return destSize ; }
/*
Name    : calculateSize
Function: This function calculates the destSize to be used in preflighting
when the destSize is equal to 0