modules/skparagraph/src/ParagraphImpl.cpp
SkRange<size_t> ParagraphImpl::getWordBoundary(unsigned offset) {
    TextBreaker breaker;
    if (!breaker.initialize(fTextSpan, UBRK_WORD)) {
        return {0, 0};
    }

    size_t currentPos = breaker.first();
    while (true) {
        auto start = currentPos;
        currentPos = breaker.next();
        if (breaker.eof()) {
            break;
        }
        if (start <= offset && currentPos > offset) {
            return {start, currentPos};
        }
    }
    return {0, 0};
}
// Finds the first and last glyphs that define a word containing
// the glyph at index offset.
// By "glyph" they mean a character index - indicated by Minikin's code
Finds the first and last glyphs that define a word containing
the glyph at index offset.
By "glyph" they mean a character index - indicated by Minikin's code
Finds the first and last glyphs that define a word containing the glyph at index offset . By " glyph " they mean a character index - indicated by Minikin ' s code
SkRange<size_t> ParagraphImpl::getWordBoundary(unsigned offset) {
    TextBreaker breaker;
    if (!breaker.initialize(fTextSpan, UBRK_WORD)) {
        return {0, 0};
    }
    size_t currentPos = breaker.first();
    while (true) {
        auto start = currentPos;
        currentPos = breaker.next();
        if (breaker.eof()) {
            break;
        }
        if (start <= offset && currentPos > offset) {
            return {start, currentPos};
        }
    }
    return {0, 0};
}
SkRange < size_t > ParagraphImpl :: getWordBoundary ( unsigned offset ) { TextBreaker breaker ; if ( ! breaker . initialize ( fTextSpan , UBRK_WORD ) ) { return { 0 , 0 } ; } size_t currentPos = breaker . first ( ) ; while ( true ) { auto start = currentPos ; currentPos = breaker . next ( ) ; if ( breaker . eof ( ) ) { break ; } if ( start <= offset && currentPos > offset ) { return { start , currentPos } ; } } return { 0 , 0 } ; }
Finds the first and last glyphs that define a word containing
the glyph at index offset.
Finds the first and last glyphs that define a word containing the glyph at index offset .