[Bf-blender-cvs] [ac147872cca] master: Fix T62594: Truncated text in UI
Jacques Lucke
noreply at git.blender.org
Fri Mar 15 15:13:16 CET 2019
Commit: ac147872cca748e33bd84da5dbb34ab22f02ffca
Author: Jacques Lucke
Date: Fri Mar 15 15:12:42 2019 +0100
Branches: master
https://developer.blender.org/rBac147872cca748e33bd84da5dbb34ab22f02ffca
Fix T62594: Truncated text in UI
Reviewers: brecht, billreynish
Differential Revision: https://developer.blender.org/D4518
===================================================================
M source/blender/editors/interface/interface_style.c
===================================================================
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);
More information about the Bf-blender-cvs
mailing list