diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-05-27 18:15:48 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-05-27 18:25:55 +0300 |
commit | c5a8a4e9d8bda11cd8314473b190189fd1303c98 (patch) | |
tree | cbfa3317dc6c90f57fb4fd544cbf080487ea7e0c /source/blender/editors/space_file/filesel.c | |
parent | be4d34ca863757528deb9968578045737fecf868 (diff) |
Fix mismatch in strings length compute in filebrowser, leading to annoying '...' in longest filename.
We must take kerning into account everywhere! Note this will disappear in upcomming filebrowser
refactor anyway.
Reported through IRC by Pablo (venomgfx), thanks.
Diffstat (limited to 'source/blender/editors/space_file/filesel.c')
-rw-r--r-- | source/blender/editors/space_file/filesel.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 29a8a06fa23..62b4bfaf179 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -401,8 +401,20 @@ void ED_fileselect_layout_tilepos(FileLayout *layout, int tile, int *x, int *y) float file_string_width(const char *str) { uiStyle *style = UI_style_get(); + float width; + UI_fontstyle_set(&style->widget); - return BLF_width(style->widget.uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); + if (style->widget.kerning == 1) { /* for BLF_width */ + BLF_enable(style->widget.uifont_id, BLF_KERNING_DEFAULT); + } + + width = BLF_width(style->widget.uifont_id, str, BLF_DRAW_STR_DUMMY_MAX); + + if (style->widget.kerning == 1) { + BLF_disable(style->widget.uifont_id, BLF_KERNING_DEFAULT); + } + + return width; } float file_font_pointsize(void) |