+ yPosition,
+ xPositionAdvance,
+ yPosition + selectionBoxInfo->lineHeight );
+
+ // Whether to retrieve the next line.
+ if( index == lastGlyphOfLine )
+ {
+ // Retrieve the next line.
+ ++lineRun;
+
+ // Get the last glyph of the new line.
+ lastGlyphOfLine = lineRun->glyphRun.glyphIndex + lineRun->glyphRun.numberOfGlyphs - 1u;
+
+ ++lineIndex;
+ if( lineIndex < firstLineIndex + numberOfLines )
+ {
+ // Get the selection box info for the next line.
+ const float currentLineOffset = selectionBoxInfo->lineOffset;
+ ++selectionBoxInfo;
+
+ selectionBoxInfo->minX = MAX_FLOAT;
+ selectionBoxInfo->maxX = MIN_FLOAT;
+
+ // The line height is the addition of the line ascender and the line descender.
+ // However, the line descender has a negative value, hence the subtraction.
+ selectionBoxInfo->lineHeight = lineRun->ascender - lineRun->descender;
+
+ // Update the line's vertical offset.
+ selectionBoxInfo->lineOffset = currentLineOffset + selectionBoxInfo->lineHeight;
+ }
+ }
+ }
+
+ // Add extra geometry to 'boxify' the selection.
+
+ if( 1u < numberOfLines )
+ {
+ // Boxify the first line.
+ lineRun = mVisualModel->mLines.Begin() + firstLineIndex;
+ const SelectionBoxInfo& firstSelectionBoxLineInfo = *( selectionBoxLinesInfo.Begin() );
+
+ bool boxifyBegin = ( LTR != lineRun->direction ) && ( LTR != startDirection );
+ bool boxifyEnd = ( LTR == lineRun->direction ) && ( LTR == startDirection );
+
+ if( boxifyBegin )
+ {
+ // Boxify at the beginning of the line.
+ mEventData->mDecorator->AddHighlight( 0.f,
+ firstSelectionBoxLineInfo.lineOffset,
+ firstSelectionBoxLineInfo.minX,
+ firstSelectionBoxLineInfo.lineOffset + firstSelectionBoxLineInfo.lineHeight );
+ }
+
+ if( boxifyEnd )
+ {
+ // Boxify at the end of the line.
+ mEventData->mDecorator->AddHighlight( firstSelectionBoxLineInfo.maxX,
+ firstSelectionBoxLineInfo.lineOffset,
+ mVisualModel->mControlSize.width,
+ firstSelectionBoxLineInfo.lineOffset + firstSelectionBoxLineInfo.lineHeight );
+ }
+
+ // Boxify the central lines.
+ if( 2u < numberOfLines )
+ {
+ for( Vector<SelectionBoxInfo>::ConstIterator it = selectionBoxLinesInfo.Begin() + 1u,
+ endIt = selectionBoxLinesInfo.End() - 1u;
+ it != endIt;
+ ++it )
+ {
+ const SelectionBoxInfo& info = *it;
+
+ mEventData->mDecorator->AddHighlight( 0.f,
+ info.lineOffset,
+ info.minX,
+ info.lineOffset + info.lineHeight );
+
+ mEventData->mDecorator->AddHighlight( info.maxX,
+ info.lineOffset,
+ mVisualModel->mControlSize.width,
+ info.lineOffset + info.lineHeight );
+ }
+ }
+
+ // Boxify the last line.
+ lineRun = mVisualModel->mLines.Begin() + firstLineIndex + numberOfLines - 1u;
+ const SelectionBoxInfo& lastSelectionBoxLineInfo = *( selectionBoxLinesInfo.End() - 1u );
+
+ boxifyBegin = ( LTR == lineRun->direction ) && ( LTR == endDirection );
+ boxifyEnd = ( LTR != lineRun->direction ) && ( LTR != endDirection );
+
+ if( boxifyBegin )
+ {
+ // Boxify at the beginning of the line.
+ mEventData->mDecorator->AddHighlight( 0.f,
+ lastSelectionBoxLineInfo.lineOffset,
+ lastSelectionBoxLineInfo.minX,
+ lastSelectionBoxLineInfo.lineOffset + lastSelectionBoxLineInfo.lineHeight );
+ }
+
+ if( boxifyEnd )
+ {
+ // Boxify at the end of the line.
+ mEventData->mDecorator->AddHighlight( lastSelectionBoxLineInfo.maxX,
+ lastSelectionBoxLineInfo.lineOffset,
+ mVisualModel->mControlSize.width,
+ lastSelectionBoxLineInfo.lineOffset + lastSelectionBoxLineInfo.lineHeight );
+ }