[Bf-blender-cvs] [9bbb197d146] master: Work around small DPI resulting in blurry fonts, clamping auto DPI to minimum 96.

Brecht Van Lommel noreply at git.blender.org
Mon Jul 17 18:55:05 CEST 2017


Commit: 9bbb197d146d87c053d39a0dfdd9db4cffc53c61
Author: Brecht Van Lommel
Date:   Mon Jul 17 14:10:57 2017 +0200
Branches: master
https://developer.blender.org/rB9bbb197d146d87c053d39a0dfdd9db4cffc53c61

Work around small DPI resulting in blurry fonts, clamping auto DPI to minimum 96.

Since we added auto DPI on Linux, on some systems the UI draws smaller than before
due to the monitor reporting DPI values like 88. Blender font drawing gives quite
blurry results for such slightly smaller DPI, apparently because the builtin font
isn't really designed for such small font sizes. As a workaround this clamps the
auto DPI to minimum 96, since the main case we are interested in supporting is
high DPI displays anyway.

Differential Revision: https://developer.blender.org/D2740

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

M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/windowmanager/intern/wm_window.c

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

diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index c0f2dbd0706..224efbbde7a 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3926,12 +3926,18 @@ static void rna_def_userdef_system(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "dpi", PROP_INT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-	RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display");
+	RNA_def_property_ui_text(prop, "DPI",
+	                         "DPI for addons to use when drawing custom user interface elements. Controlled by "
+	                         "operating system settings and Blender UI scale, with a reference value of 72 DPI. "
+	                         "Note that since this value includes a user defined scale, it is not always the "
+	                         "actual monitor DPI.");
 
 	prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE);
 	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 	RNA_def_property_float_sdna(prop, NULL, "pixelsize");
-	RNA_def_property_ui_text(prop, "Pixel Size", "");
+	RNA_def_property_ui_text(prop, "Pixel Size",
+	                         "Suggested line thickness and point size in pixels, for addons drawing custom user "
+	                         "interface elements. Controlled by operating system settings and Blender UI scale.");
 
 	prop = RNA_def_property(srna, "font_path_ui", PROP_STRING, PROP_FILEPATH);
 	RNA_def_property_string_sdna(prop, NULL, "font_path_ui");
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 8afeb8e7b3d..e7a1643a1ff 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -379,6 +379,11 @@ void WM_window_set_dpi(wmWindow *win)
 {
 	int auto_dpi = GHOST_GetDPIHint(win->ghostwin);
 
+	/* Clamp auto DPI to 96, since our font/interface drawing does not work well
+	 * with lower sizes. The main case we are interested in supporting is higher
+	 * DPI. If a smaller UI is desired it is still possible to adjust UI scale. */
+	auto_dpi = MAX2(auto_dpi, 96);
+
 	/* Lazily init UI scale size, preserving backwards compatibility by
 	 * computing UI scale from ratio of previous DPI and auto DPI */
 	if (U.ui_scale == 0) {




More information about the Bf-blender-cvs mailing list