[Bf-extensions-cvs] [0221dbb3] master: Addons: fix dpi preference value for blf.size D5793

meta-androcto noreply at git.blender.org
Mon Sep 23 03:57:15 CEST 2019


Commit: 0221dbb370d706c91c105e933be1048931c8fe95
Author: meta-androcto
Date:   Mon Sep 23 11:56:54 2019 +1000
Branches: master
https://developer.blender.org/rBA0221dbb370d706c91c105e933be1048931c8fe95

Addons: fix dpi preference value for blf.size D5793

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

M	measureit/measureit_geometry.py
M	object_carver/carver_draw.py
M	object_scatter/operator.py
M	space_view3d_math_vis/draw.py

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

diff --git a/measureit/measureit_geometry.py b/measureit/measureit_geometry.py
index f1a09516..00d12bee 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 695d0ca1..922807ee 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 5294d173..742eec95 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 8fe9f6a8..8adeeb0b 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:



More information about the Bf-extensions-cvs mailing list