aboutsummaryrefslogtreecommitdiff
path: root/gui/widgets/edittext.cpp
diff options
context:
space:
mode:
authorJohannes Schickel2012-01-08 02:33:34 +0100
committerWillem Jan Palenstijn2012-01-29 16:26:20 +0100
commit9f3fbe1bd773664b1e86241e71875cd97230d791 (patch)
tree1eae5b18934a2433aef7205a86bdd9a999261346 /gui/widgets/edittext.cpp
parentd21ae1aa40f7ef5442d98c377800a0157af069c8 (diff)
downloadscummvm-rg350-9f3fbe1bd773664b1e86241e71875cd97230d791.tar.gz
scummvm-rg350-9f3fbe1bd773664b1e86241e71875cd97230d791.tar.bz2
scummvm-rg350-9f3fbe1bd773664b1e86241e71875cd97230d791.zip
GRAPHICS/GUI: Implement kerning support for Font.
This adapts the related graphics code, which is the generic Font API and the TTF font implementation. It furthermore adapts the GUI to properly take care of kerning in text input widgets.
Diffstat (limited to 'gui/widgets/edittext.cpp')
-rw-r--r--gui/widgets/edittext.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp
index 0337fe1e87..af8ab8aa5b 100644
--- a/gui/widgets/edittext.cpp
+++ b/gui/widgets/edittext.cpp
@@ -67,10 +67,13 @@ void EditTextWidget::handleMouseDown(int x, int y, int button, int clickCount) {
int width = 0;
uint i;
+ uint last = 0;
for (i = 0; i < _editString.size(); ++i) {
- width += g_gui.theme()->getCharWidth(_editString[i], _font);
+ const uint cur = _editString[i];
+ width += g_gui.getCharWidth(cur, _font) + g_gui.getKerningOffset(last, cur, _font);
if (width >= x)
break;
+ last = cur;
}
if (setCaretPos(i))
draw();