After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735316 - Default font antialiasing results in wrong behavior on OS X
Default font antialiasing results in wrong behavior on OS X
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.13.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2014-08-24 10:40 UTC by jessevdk@gmail.com
Modified: 2015-01-30 23:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkSettings: Consider default settings for font hinting and antialias. (3.05 KB, patch)
2014-12-03 00:23 UTC, Matias De lellis
none Details | Review
GtkSettings: Set gtk-xft-hinting/antialias active by default. (2.04 KB, patch)
2014-12-03 13:31 UTC, Matias De lellis
none Details | Review

Description jessevdk@gmail.com 2014-08-24 10:40:12 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).
Comment 1 Matthias Clasen 2014-08-27 03:30:22 UTC
See bug 538182
Comment 2 Behdad Esfahbod 2014-08-28 17:48:26 UTC
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.
Comment 3 Matias De lellis 2014-12-02 23:15:35 UTC
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
Comment 4 Matias De lellis 2014-12-02 23:48:29 UTC
Additional info: hint_style = -1 = DEFAULT, also never is considered.

I just made a patch. Test it and then upload for you comment..

Regards.
Comment 5 Matias De lellis 2014-12-03 00:23:09 UTC
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.
Comment 6 Matias De lellis 2014-12-03 13:31:55 UTC
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
Comment 7 Matthias Clasen 2015-01-30 23:31:00 UTC
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.