From 0221dbb370d706c91c105e933be1048931c8fe95 Mon Sep 17 00:00:00 2001 From: meta-androcto <meta.androcto1@gmail.com> Date: Mon, 23 Sep 2019 11:56:54 +1000 Subject: [PATCH] Addons: fix dpi preference value for blf.size D5793 --- measureit/measureit_geometry.py | 2 +- object_carver/carver_draw.py | 8 ++++---- object_scatter/operator.py | 2 +- space_view3d_math_vis/draw.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/measureit/measureit_geometry.py b/measureit/measureit_geometry.py index f1a095163..00d12beed 100644 --- a/measureit/measureit_geometry.py +++ b/measureit/measureit_geometry.py @@ -818,7 +818,7 @@ def draw_text(myobj, pos2d, display_text, rgba, fsize, align='L', text_rot=0.0): x_pos, y_pos = pos2d font_id = 0 ui_scale = bpy.context.preferences.system.ui_scale - blf.size(font_id, round(fsize * ui_scale), bpy.context.preferences.system.dpi) + blf.size(font_id, round(fsize * ui_scale), 72) # blf.size(font_id, fsize, dpi) # height of one line mwidth, mheight = blf.dimensions(font_id, "Tp") # uses high/low letters diff --git a/object_carver/carver_draw.py b/object_carver/carver_draw.py index 695d0ca11..922807ee5 100644 --- a/object_carver/carver_draw.py +++ b/object_carver/carver_draw.py @@ -134,7 +134,7 @@ def draw_callback_px(self, context): # Get the size of the text text_size = 18 if region.width >= 850 else 12 ui_scale = bpy.context.preferences.system.ui_scale - blf.size(0, round(text_size * ui_scale), bpy.context.preferences.system.dpi) + blf.size(0, round(text_size * ui_scale), 72) # Help Display if (self.ObjectMode is False) and (self.ProfileMode is False): @@ -232,7 +232,7 @@ def draw_callback_px(self, context): # Display boolean mode text_size = 40 if region.width >= 850 else 20 - blf.size(0, round(text_size * ui_scale), bpy.context.preferences.system.dpi) + blf.size(0, round(text_size * ui_scale), 72) draw_string(self, color2, color2, region_width - (blf.dimensions(0, BooleanMode)[0]) / 2, \ y_txt + bloc_height + 16, BooleanMode, 0, divide = 2) @@ -241,7 +241,7 @@ def draw_callback_px(self, context): if self.AskHelp is False: # "H for Help" text - blf.size(0, round(13 * ui_scale), bpy.context.preferences.system.dpi) + blf.size(0, round(13 * ui_scale), 72) help_txt = "[" + self.carver_prefs.Key_Help + "] for help" txt_width = blf.dimensions(0, help_txt)[0] txt_height = (blf.dimensions(0, "gM")[1] * 1.45) @@ -326,7 +326,7 @@ def draw_callback_px(self, context): ["Gap for rows or columns", self.carver_prefs.Key_Gapy + " " + self.carver_prefs.Key_Gapx] ] - blf.size(0, round(15 * ui_scale), bpy.context.preferences.system.dpi) + blf.size(0, round(15 * ui_scale), 72) help_txt, bloc_height, max_option, max_key, comma = get_text_info(self, context, help_txt) draw_string(self, color1, color2, xHelp, yHelp, help_txt, max_option) diff --git a/object_scatter/operator.py b/object_scatter/operator.py index 5294d173f..742eec95a 100644 --- a/object_scatter/operator.py +++ b/object_scatter/operator.py @@ -394,7 +394,7 @@ def draw_text(location, text, size=15, color=(1, 1, 1, 1)): font_id = 0 ui_scale = bpy.context.preferences.system.ui_scale blf.position(font_id, *location) - blf.size(font_id, round(size * ui_scale), bpy.context.preferences.system.dpi) + blf.size(font_id, round(size * ui_scale), 72) blf.draw(font_id, text) diff --git a/space_view3d_math_vis/draw.py b/space_view3d_math_vis/draw.py index 8fe9f6a87..8adeeb0be 100644 --- a/space_view3d_math_vis/draw.py +++ b/space_view3d_math_vis/draw.py @@ -82,7 +82,7 @@ def draw_callback_px(): font_id = 0 ui_scale = context.preferences.system.ui_scale - blf.size(font_id, round(12 * ui_scale), context.preferences.system.dpi) + blf.size(font_id, round(12 * ui_scale), 72) data_matrix, data_quat, data_euler, data_vector, data_vector_array = utils.console_math_data() if not data_matrix and not data_quat and not data_euler and not data_vector and not data_vector_array: -- GitLab