Commit d0229edd authored by bitplane's avatar bitplane

Fix highlighting in IGUIEditBox where kerning pairs are used in the font. For...

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-e03cc46cb475
parent 5f38dfa9
Changes in 1.6 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* - IOSOperator::getTextFromClipboard returns now const c8* instead of c8*
- Support for copy&paste on linux (X11) added (fixing bug 2804014 found by Pan) - Support for copy&paste on linux (X11) added (fixing bug 2804014 found by Pan)
......
...@@ -803,6 +803,12 @@ void CGUIEditBox::draw() ...@@ -803,6 +803,12 @@ void CGUIEditBox::draw()
// highlight start is on this line // highlight start is on this line
s = txtLine->subString(0, realmbgn - startPos); s = txtLine->subString(0, realmbgn - startPos);
mbegin = font->getDimension(s.c_str()).Width; 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; lineStartPos = realmbgn - startPos;
} }
if (i == hlineStart + hlineCount - 1) if (i == hlineStart + hlineCount - 1)
...@@ -846,7 +852,8 @@ void CGUIEditBox::draw() ...@@ -846,7 +852,8 @@ void CGUIEditBox::draw()
startPos = BrokenTextPositions[cursorLine]; startPos = BrokenTextPositions[cursorLine];
} }
s = txtLine->subString(0,CursorPos-startPos); 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) if (focus && (os::Timer::getTime() - BlinkStartTime) % 700 < 350)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment