From 3c91ccced60823fc3e72c16bffc3fcd6178455fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 2 Jan 2018 15:10:27 +0100 Subject: [PATCH] Texture Browser: use DPI from user preferences --- CHANGELOG.md | 1 + blender_cloud/texture_browser.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b367cf8..3477ea5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - When re-opening the Texture Browser it now opens in the same folder as where it was when closed. - In the texture browser, draw the components of the texture (i.e. which map types are available), such as 'bump, normal, specular'. +- Use Interface Scale setting from user preferences to draw the Texture Browser text. ## Version 1.7.5 (2017-10-06) diff --git a/blender_cloud/texture_browser.py b/blender_cloud/texture_browser.py index de265e6..cd31316 100644 --- a/blender_cloud/texture_browser.py +++ b/blender_cloud/texture_browser.py @@ -76,9 +76,8 @@ class MenuItem: icon_margin_y = 4 text_margin_x = 6 - text_size = 16 - text_size_small = 13 - text_dpi = 72 + text_size = 12 + text_size_small = 10 DEFAULT_ICONS = { 'FOLDER': os.path.join(library_icons_path, 'folder.png'), @@ -215,10 +214,11 @@ class MenuItem: # draw some text font_id = 0 + text_dpi = bpy.context.user_preferences.system.dpi text_x = self.x + self.icon_margin_x + ICON_WIDTH + self.text_margin_x text_y = self.y + ICON_HEIGHT * 0.5 - 0.25 * self.text_size blf.position(font_id, text_x, text_y, 0) - blf.size(font_id, self.text_size, self.text_dpi) + blf.size(font_id, self.text_size, text_dpi) blf.draw(font_id, self.label_text) # Draw the components of the texture (i.e. which map types are available) @@ -236,7 +236,7 @@ class MenuItem: return bgl.glColor4f(1.0, 1.0, 1.0, 0.5) - blf.size(font_id, self.text_size_small, self.text_dpi) + blf.size(font_id, self.text_size_small, text_dpi) blf.position(font_id, text_x, self.y + 0.5 * self.text_size_small, 0) blf.draw(font_id, ', '.join(sorted(map_types)))