[Bf-blender-cvs] [e46055ae9db] master: UI: Fix offset of vertical scale indicators

Pablo Vazquez noreply at git.blender.org
Fri Oct 15 11:54:11 CEST 2021


Commit: e46055ae9dbd77271878b35cdd061cb7cc7e1afc
Author: Pablo Vazquez
Date:   Fri Oct 15 11:54:07 2021 +0200
Branches: master
https://developer.blender.org/rBe46055ae9dbd77271878b35cdd061cb7cc7e1afc

UI: Fix offset of vertical scale indicators

`BLF_height_max()` uses the tallest character in the font, and many characters
in our font are taller than numbers. Use `BLF_height` with `0` as reference instead.

Fix by @harley, thanks!

===================================================================

M	source/blender/editors/interface/view2d_draw.c

===================================================================

diff --git a/source/blender/editors/interface/view2d_draw.c b/source/blender/editors/interface/view2d_draw.c
index a4b37e571d7..b1869fbf2f9 100644
--- a/source/blender/editors/interface/view2d_draw.c
+++ b/source/blender/editors/interface/view2d_draw.c
@@ -405,7 +405,7 @@ static void draw_vertical_scale_indicators(const ARegion *region,
   const float xpos = (rect->xmin + x_offset) * UI_DPI_FAC;
   const float ymin = rect->ymin;
   const float ymax = rect->ymax;
-  const float y_offset = (BLF_height_max(font_id) / 2.0f) - U.pixelsize;
+  const float y_offset = (BLF_height(font_id, "0", 1) / 2.0f) - U.pixelsize;
 
   for (uint i = 0; i < steps; i++) {
     const float ypos_view = start + i * distance;



More information about the Bf-blender-cvs mailing list