Gwen::Rect Text::GetCharacterPosition( int iChar ) { if ( !m_Lines.empty() ) { TextLines::iterator it = m_Lines.begin(); TextLines::iterator itEnd = m_Lines.end(); int iChars = 0; while ( it != itEnd ) { Text* pLine = *it; ++it; iChars += pLine->Length(); if ( iChars <= iChar ) { continue; } iChars -= pLine->Length(); Gwen::Rect rect = pLine->GetCharacterPosition( iChar - iChars ); rect.x += pLine->X(); rect.y += pLine->Y(); return rect; } } if ( Length() == 0 || iChar == 0 ) { Gwen::Point p = GetSkin()->GetRender()->MeasureText( GetFont(), L" " ); return Gwen::Rect( 1, 0, 0, p.y ); } UnicodeString sub = m_String.GetUnicode().substr( 0, iChar ); Gwen::Point p = GetSkin()->GetRender()->MeasureText( GetFont(), sub ); return Rect( p.x, 0, 0, p.y ); }