Comment 11 for bug 310353

Revision history for this message
In , Federico Mena-Quintero (federico-novell) wrote :

I don't know the whole code, but here are some data points:

1. gnome-settings-daemon queries the configuration value stored in GConf for "/desktop/gnome/font_rendering/dpi". It then propagates this value using the XSETTINGS protocol (on the "Xft/DPI" property), and also sets the "Xft.dpi" Xresource for apps which may want to use it (GNOME doesn't use that one).

2. The default value for /desktop/gnome/font_rendering/dpi in the GConf schema is 96.

3. GTK+ apps query the XSETTINGS manager for the "Xft/DPI property", and set this as the GdkScreen's resolution. If an XSETTINGS manager is not running, GdkScreen uses the magic value of -1 for the resolution.

4. GtkWidget queries GdkScreen for the resolution, and sets that value on the Pango font rendering context.

5. Pango sees the resolution set in the context; if it is -1 (unset), it uses a fallback value of 96 DPI. This is what gets used for rendering.

The rationale is as Dan says. X servers don't provide correct DPI information in an uncomfortably large percentage of cases, so GNOME ignores that and a) provides a reasonable default value; b) lets the user change it easily.

We can put a trivial patch in control-center2 to keep the Xft.dpi Xresource from being set in gnome-settings-daemon (as a quick hack to address the original comment).

The root of the problem is that the X server does not provide reasonable values. If we could trust it, there would be no need for this setting at all :)

About comment #4:

GDM probably picks up the values from xorg.conf because there's no XSETTINGS manager running at that point, although I don't know why my point (5) wouldn't apply there.

About comment #5:

I don't know why you got those weird fonts in your desktop. Was gnome-settings-daemon running? If not, why did it crash [that would be a bad bug]? I also don't know why my point (5) wouldn't apply.

You can try seeing what resolution values get passed around in the functions in pangocairo-fcfontmap.c.