diff options
author | Matt Ebb <matt@mke3.net> | 2010-04-02 15:15:37 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-04-02 15:15:37 +0400 |
commit | 5d155868fbb6ffd40f01d47d1867dc482282da21 (patch) | |
tree | f44287117ea825134b7028aba3380d93f226a36d /source/blender/editors/interface/interface_style.c | |
parent | d03d42fe72b1326d575dd0e1a0402501a358a836 (diff) |
Fix [#21694] text input box last character not editable
Font kerning needs to be set in order to get accurate results out of BLF_width().
Would be nice if this was more automatic, I've added it to a few other places that
seem like they need this though it's a little unclear due to the globals etc. Also
some other minor tweaks when editing text fields.
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index ae149cad480..aaebdf5693a 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -237,9 +237,19 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, char *str) int UI_GetStringWidth(char *str) { uiStyle *style= U.uistyles.first; + uiFontStyle *fstyle= &style->widget; + int width; - uiStyleFontSet(&style->widget); - return BLF_width(str); + if (fstyle->kerning==1) /* for BLF_width */ + BLF_enable(BLF_KERNING_DEFAULT); + + uiStyleFontSet(fstyle); + width= BLF_width(str); + + if (fstyle->kerning==1) + BLF_disable(BLF_KERNING_DEFAULT); + + return width; } /* temporarily, does widget font */ |