Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <mail@jlucke.com>2019-03-15 17:12:42 +0300
committerJacques Lucke <mail@jlucke.com>2019-03-15 17:12:42 +0300
commitac147872cca748e33bd84da5dbb34ab22f02ffca (patch)
treeafd3e2c2ed6ae326cd20da43faf64134ff7458de /source/blender/editors/interface/interface_style.c
parent2e043c266bfff4b0de7c1cb2b324549cdf5a742b (diff)
Fix T62594: Truncated text in UI
Reviewers: brecht, billreynish Differential Revision: https://developer.blender.org/D4518
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r--source/blender/editors/interface/interface_style.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 4aea1fad89f..f59bc5759e1 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -182,17 +182,15 @@ void UI_fontstyle_draw_ex(
if (fs_params->align == UI_STYLE_TEXT_CENTER) {
xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len)));
- /* don't center text if it chops off the start of the text, 2 gives some margin */
- if (xofs < 2) {
- xofs = 2;
- }
}
else if (fs_params->align == UI_STYLE_TEXT_RIGHT) {
- xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len) - 0.1f * U.widget_unit;
+ xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len);
}
- /* clip is very strict, so we give it some space */
- BLF_clipping(fs->uifont_id, rect->xmin - 2, rect->ymin - 4, rect->xmax + 1, rect->ymax + 4);
+ yofs = MAX2(0, yofs);
+ xofs = MAX2(0, xofs);
+
+ BLF_clipping(fs->uifont_id, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
BLF_position(fs->uifont_id, rect->xmin + xofs, rect->ymin + yofs, 0.0f);
BLF_color4ubv(fs->uifont_id, col);