Addons: fix dpi preference value for blf.size D5793

This commit is contained in:
Brendon Murphy 2019-09-23 11:56:54 +10:00
parent cf63c4fb3a
commit 0221dbb370
4 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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: