Fix most of 'disappearing' first letter in right-aligned labels.

BLF' blf_font_width_to_strlen() could easily generate strings with up to
nearly two pixels length over requested limit!

Note that the fiddling between floats and ints values make things really
confusing here... :/

There is still a few limit cases where, even though computed str length
is now always below reauested limit, we still get first letter
disappearing, no idea why currently.
This commit is contained in:
2018-06-24 17:47:40 +02:00
parent 6454319033
commit d0856d1d54
2 changed files with 4 additions and 2 deletions

View File

@@ -1500,6 +1500,8 @@ float UI_text_clip_middle_ex(
BLF_disable(fstyle->uifont_id, BLF_KERNING_DEFAULT);
}
BLI_assert(strwidth <= okwidth);
return strwidth;
}