Fix highlighting in IGUIEditBox where kerning pairs are used in the font. For example in future italic, OS or other custom fonts.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2444 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
5f38dfa9c5
commit
d0229edd2d
|
@ -1,5 +1,7 @@
|
|||
Changes in 1.6
|
||||
|
||||
- Fix highlighting in IGUIEditBox where kerning pairs are used in the font. For example in future italic, OS or other custom fonts.
|
||||
|
||||
- IOSOperator::getTextFromClipboard returns now const c8* instead of c8*
|
||||
|
||||
- Support for copy&paste on linux (X11) added (fixing bug 2804014 found by Pan)
|
||||
|
|
|
@ -803,6 +803,12 @@ void CGUIEditBox::draw()
|
|||
// highlight start is on this line
|
||||
s = txtLine->subString(0, realmbgn - startPos);
|
||||
mbegin = font->getDimension(s.c_str()).Width;
|
||||
|
||||
// deal with kerning
|
||||
mbegin += font->getKerningWidth(
|
||||
&((*txtLine)[realmbgn - startPos]),
|
||||
realmbgn - startPos > 0 ? &((*txtLine)[realmbgn - startPos - 1]) : 0);
|
||||
|
||||
lineStartPos = realmbgn - startPos;
|
||||
}
|
||||
if (i == hlineStart + hlineCount - 1)
|
||||
|
@ -846,7 +852,8 @@ void CGUIEditBox::draw()
|
|||
startPos = BrokenTextPositions[cursorLine];
|
||||
}
|
||||
s = txtLine->subString(0,CursorPos-startPos);
|
||||
charcursorpos = font->getDimension(s.c_str()).Width;
|
||||
charcursorpos = font->getDimension(s.c_str()).Width +
|
||||
font->getKerningWidth(L"_", CursorPos-startPos > 0 ? &((*txtLine)[CursorPos-startPos-1]) : 0);
|
||||
|
||||
if (focus && (os::Timer::getTime() - BlinkStartTime) % 700 < 350)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue