Hi @lb90 ,
TBH I was surprised to see that the user’s settings.ini
actually had a lower priority than GdkDisplay… Sounds fine for the one under /etc, but user settings should allow more flexibility I think.
Anyway, I don’t think we can change the way settings.ini
are managed, too risky.
On Linux everyone uses the fontconfig backend for rendering so my particular example above is not a problem.
On Windows we have the choice between win32 and fontconfig backends, so one possibility could be to check for the default Pango renderer and to apply the GdkDisplay settings only if we use the win32 one, otherwise, for fontconfig, we will fallback on settings.ini
.
I tested that patch yesterday, seems to work fine:
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index c92853e70b..8fc104a689 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <glib/gprintf.h>
#include <pango/pangowin32.h>
+#include <pango/pangofc-fontmap.h>
#include "gdkdisplayprivate.h"
#include "gdkprivate-win32.h"
@@ -64,6 +65,9 @@ gboolean
_gdk_win32_get_setting (const char *name,
GValue *value)
{
+ PangoFontMap *fontmap = pango_cairo_font_map_get_default ();
+ gboolean use_fontconfig = PANGO_IS_FC_FONT_MAP (fontmap);
+
if (strcmp ("gtk-alternative-button-order", name) == 0)
{
GDK_NOTE(MISC, g_print("gdk_display_get_setting(\"%s\") : TRUE\n", name));
@@ -111,7 +115,7 @@ _gdk_win32_get_setting (const char *name,
g_value_set_int (value, i);
return TRUE;
}
- else if (strcmp ("gtk-font-name", name) == 0)
+ else if (strcmp ("gtk-font-name", name) == 0 && !use_fontconfig)
{
char *font_name = NULL;
HDC hdc = NULL;
@@ -195,7 +199,7 @@ _gdk_win32_get_setting (const char *name,
}
}
}
- else if (strcmp ("gtk-xft-antialias", name) == 0)
+ else if (strcmp ("gtk-xft-antialias", name) == 0 && !use_fontconfig)
{
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name));
g_value_set_int (value, 1);
@@ -225,19 +229,19 @@ _gdk_win32_get_setting (const char *name,
}
}
}
- else if (strcmp ("gtk-xft-hinting", name) == 0)
+ else if (strcmp ("gtk-xft-hinting", name) == 0 && !use_fontconfig)
{
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : 1\n", name));
g_value_set_int (value, 1);
return TRUE;
}
- else if (strcmp ("gtk-xft-hintstyle", name) == 0)
+ else if (strcmp ("gtk-xft-hintstyle", name) == 0 && !use_fontconfig)
{
g_value_set_static_string (value, "hintfull");
GDK_NOTE(MISC, g_print ("gdk_screen_get_setting(\"%s\") : %s\n", name, g_value_get_string (value)));
return TRUE;
}
- else if (strcmp ("gtk-xft-rgba", name) == 0)
+ else if (strcmp ("gtk-xft-rgba", name) == 0 && !use_fontconfig)
{
unsigned int orientation = 0;
if (SystemParametersInfoW (SPI_GETFONTSMOOTHINGORIENTATION, 0, &orientation, 0))
Does it look sane enough to propose a MR?
The advantage is that it doesn’t impact anything when using the default win32 backend, only users explicitly requesting fontconfig will benefit for that flexibility.