private void previousSegment ( ) { assert ( checkDir < 0 && seq == rawSeq && pos != start ) ; // The input text [pos..segmentLimit[ passes the FCD check. int p = pos ; int nextCC = 0 ; for ( ; ; ) { // Fetch the previous character's fcd16 value. int q = p ; int c = Character . codePointBefore ( seq , p ) ; p -= Character . charCount ( c ) ; int fcd16 = nfcImpl . getFCD16 ( c ) ; int trailCC = fcd16 & 0xff ; if ( trailCC == 0 && q != pos ) { // FCD boundary after the [p, q[ character. start = segmentStart = q ; break ; } if ( trailCC != 0 && ( ( nextCC != 0 && trailCC > nextCC ) || CollationFCD . isFCD16OfTibetanCompositeVowel ( fcd16 ) ) ) { // Fails FCD check. Find the previous FCD boundary and normalize. do { q = p ; if ( fcd16 <= 0xff || p == rawStart ) { break ; } c = Character . codePointBefore ( seq , p ) ; p -= Character . charCount ( c ) ; } while ( ( fcd16 = nfcImpl . getFCD16 ( c ) ) != 0 ) ; normalize ( q , pos ) ; pos = limit ; break ; } nextCC = fcd16 >> 8 ; if ( p == rawStart || nextCC == 0 ) { // FCD boundary before the following character. start = segmentStart = p ; break ; } } assert ( pos != start ) ; checkDir = 0 ; }
Extend the FCD text segment backward or normalize around pos . To be called when checkDir < 0 && pos ! = start . Returns with checkDir == 0 and pos ! = start .