[gedit/wip/3.14-osx] [osx] Override gtksettings font settings



commit a1d51a2b43a50fef158c4ba6c6a6545860518a5b
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Sun Aug 24 12:08:05 2014 +0200

    [osx] Override gtksettings font settings
    
    This is the easiest way to get correct text anti-aliasing rendering
    on OS X. Basically, this sets all font settings to the default, which
    in the end results in cairo drawing with the default OS X settings.

 gedit/gedit-app-osx.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app-osx.c b/gedit/gedit-app-osx.c
index f54f91d..f78ab85 100644
--- a/gedit/gedit-app-osx.c
+++ b/gedit/gedit-app-osx.c
@@ -273,6 +273,8 @@ static void
 gedit_app_osx_startup (GApplication *application)
 {
        GeditAppOSX *app_osx;
+       GtkSettings *settings;
+       cairo_font_options_t *fopts;
 
        const gchar *replace_accels[] = {
                "<Primary><Alt>F",
@@ -281,6 +283,15 @@ gedit_app_osx_startup (GApplication *application)
 
        G_APPLICATION_CLASS (gedit_app_osx_parent_class)->startup (application);
 
+       /* Do this to force the initial font settings from gtksettings */
+       settings = gtk_settings_get_default ();
+       gtk_settings_set_string_property (settings, "gtk-font-name", "Lucida Grande 13", "app");
+
+       fopts = cairo_font_options_create ();
+
+       gdk_screen_set_font_options (gdk_screen_get_default (), fopts);
+       cairo_font_options_destroy (fopts);
+
        gtk_application_set_accels_for_action (GTK_APPLICATION (application),
                                               "win.replace",
                                               replace_accels);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]