GNOME Bugzilla – Bug 735316
Default font antialiasing results in wrong behavior on OS X
Last modified: 2015-01-30 23:56:15 UTC
In GtkSettings, the cairo font antialiasing setting is derived from the xft subpixel ordering and antialias settings. However, the default setting is set to CAIRO_ANTIALIAS_GRAY. This results in forcefully bad (antialiasing but no fontsmoothing on OS X) text rendering in gtk applications on OS X (for example in gedit). Even though I could probably construct the settings such that I get SUBPIXEL antialiasing (which would end up having the same antialias settings as the default on my system), it is 1) semantically wrong to change the subpixel ordering setting to get SUBPIXEL antialiasing 2) would still force an antialiasing mode independent of the systems default I did a quick test which changes the initial antialias value to CAIRO_ANTIALIAS_DEFAULT, and this works as expected at least on my system and solves the problem. I checked the various cairo backends, and for where it applies, the DEFAULT and GRAY settings are the same (except for the quartz backend obviously).
See bug 538182
I think the right way to fix this is to leave the defaults as they are and implement correctly populating settings from OS X system preferences on the settings object. Ie, you need a patch for gdk/quartz/. But I don't know the details enough to say exactly what.
Hi, Sorry for the intrusion Note that all programs that using using Gtk in Windows have the patch #538182 reverted to improve the fonts in windows This option, particularly CAIRO_ANTIALIAS_DEFAULT makes cairo decide the better option according to configuration of system. In windows it select Xleartype. See: http://cgit.freedesktop.org/cairo/tree/src/win32/cairo-win32-font.c#n340 And: http://cgit.freedesktop.org/cairo/tree/src/win32/cairo-win32-font.c#n274 I did not found the same code on quartz backend, but I guess it must be similar. Well, but there is another problem. The documentation clearly says: "gtk-xft-antialias" = -1 = DEFAULT. See: https://git.gnome.org/browse/gtk+/tree/gtk/gtksettings.c#n548 ..but sentences that set this option never consider this value. See: https://git.gnome.org/browse/gtk+/tree/gtk/gtksettings.c#n2993 Could be added a simple: > else > antialias_mode = CAIRO_ANTIALIAS_DEFAULT; Only this, and solves part of the problem. ;) Regards
Additional info: hint_style = -1 = DEFAULT, also never is considered. I just made a patch. Test it and then upload for you comment.. Regards.
Created attachment 292032 [details] [review] GtkSettings: Consider default settings for font hinting and antialias. Hi, A patch for GtkSetting considering all hinting and antialias options. gtk-xft-hinting: * No: Disables hinting. * Yes: Set hinting according to "gtk-xft-hintstyle", otherwise CAIRO_HINT_STYLE_NONE as before. * Default: Lets cairo decide the best option. gtk-xft-antialias: * No: Disable antialias. * Yes: Set Subpixel if gtk-xft-rgba is setted, otherwise CAIRO_ANTIALIAS_GRAY as before. * Default: Lets cairo decide the best option. As you can see, consider all options and use as fallback the options that had before. But the important thing is: * Disable the options when specifically says NO. * Let cairo decide when they put default. * And when you set up specifically YES, configure according to the rest of the preferences, and in any case, everything is the same as before.
Created attachment 292068 [details] [review] GtkSettings: Set gtk-xft-hinting/antialias active by default. NOTE: Incremental patch With this the behavior is the same as before. By default ALIASING = GREY, and Gnome, xfce, etc. can properly configure these options. On other platforms, where there are no tools to configure, Would have to configure these options -1 on setting.ini and and therefore let cairo decide the best options. I.g Cleartype on windows. Also note that neither gnome or xfce, can set these options as DEFAULT. Only Active and disable, and if active, allows you to customize the settings with hintstyle and rgba options. So if it really causes a problem, (would be great to have a test to check this), using graphical dialog to set it never will be problems. But now allowed to use the cairo defaults on other platforms writing directly on the file setting.ini
The first patch made sense to me, so I have applied a variation of it. I don't want to change the defaults of the settings, though.