- // The character is in this group of words.
- for( WordLayoutInfoContainer::const_iterator wordIt = wordGroupLayoutInfo.mWordsLayoutInfo.begin(),
- wordEndIt = wordGroupLayoutInfo.mWordsLayoutInfo.end();
- ( !found ) && ( wordIt != wordEndIt );
- ++wordIt, ++indices.mWordIndex )
- {
- const WordLayoutInfo& wordLayoutInfo( *wordIt );
-
- if( currentIndex + wordLayoutInfo.mCharactersLayoutInfo.size() > index )
- {
- // The character is in this word
- indices.mCharacterIndex = index - currentIndex;
- found = true;
- }
- else
- {
- // check in the next word.
- currentIndex += wordLayoutInfo.mCharactersLayoutInfo.size();
- }
- } // end words.
- if( !wordGroupLayoutInfo.mWordsLayoutInfo.empty() )
- {
- --indices.mWordIndex;
- }
+ // The character is in this word
+ indices.mCharacterIndex = index - currentIndex;
+ indices.mCharacterParagraphIndex = index - currentCharactersTraversed;
+ found = true;