[Bf-blender-cvs] [d730f79e0ee] master: Cleanup: use mono-space font drawing for single character display

Campbell Barton noreply at git.blender.org
Fri Feb 4 04:07:28 CET 2022


Commit: d730f79e0eee1d2d6285d4d631339647e47f2303
Author: Campbell Barton
Date:   Fri Feb 4 13:48:02 2022 +1100
Branches: master
https://developer.blender.org/rBd730f79e0eee1d2d6285d4d631339647e47f2303

Cleanup: use mono-space font drawing for single character display

This doesn't make a user visible difference since it's only used for
brackets at the moment, this is more for general correctness as the
width calculation for mono-spaced text drawing is different
(as it uses BLI_wcwidth).

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

M	source/blender/editors/space_text/text_draw.c

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

diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index 8fb55ed9b46..549264ed51a 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -90,7 +90,7 @@ static int text_font_draw(const TextDrawContext *tdc, int x, int y, const char *
 static int text_font_draw_character(const TextDrawContext *tdc, int x, int y, char c)
 {
   BLF_position(tdc->font_id, x, y, 0);
-  BLF_draw(tdc->font_id, &c, 1);
+  BLF_draw_mono(tdc->font_id, &c, 1, tdc->cwidth_px);
 
   return tdc->cwidth_px;
 }



More information about the Bf-blender-cvs mailing list