diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-02-10 06:55:37 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2011-02-10 06:55:37 +0000 |
commit | 5f66d9ac8697b19fa8cc1556bab81c5a44024af4 (patch) | |
tree | dc781a0795d122ad65d81d88c8a51c662d842d42 /src | |
parent | 67388bc8f489370792031bb7fca11eed20dcd416 (diff) |
implement fix_font_setting() for Mac OS X.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2843 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/gtkutils.c | 22 | ||||
-rw-r--r-- | src/main.c | 17 |
2 files changed, 35 insertions, 4 deletions
diff --git a/src/gtkutils.c b/src/gtkutils.c index ecf38bf5..bb234078 100644 --- a/src/gtkutils.c +++ b/src/gtkutils.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2008 Hiroyuki Yamamoto + * Copyright (C) 1999-2011 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,6 +119,26 @@ gboolean gtkut_font_can_load(const gchar *str) } return can_load; +#elif defined(__APPLE__) + PangoFontDescription *desc; + PangoContext *context; + PangoFont *font; + gboolean can_load = FALSE; + + desc = pango_font_description_from_string(str); + if (desc) { + context = gdk_pango_context_get_for_screen + (gdk_screen_get_default()); + font = pango_context_load_font(context, desc); + if (font) { + can_load = TRUE; + g_object_unref(font); + } + g_object_unref(context); + pango_font_description_free(desc); + } + + return can_load; #else return FALSE; #endif @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2010 Hiroyuki Yamamoto + * Copyright (C) 1999-2011 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -152,7 +152,7 @@ static struct RemoteCmd { mainwin->mainwin_cid); \ } -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) || defined(__APPLE__) static void fix_font_setting (void); #endif @@ -278,7 +278,7 @@ int main(int argc, char *argv[]) gtk_major_version, gtk_minor_version, gtk_micro_version, TARGET_ALIAS); -#ifdef G_OS_WIN32 +#if defined(G_OS_WIN32) || defined(__APPLE__) fix_font_setting(); #endif @@ -438,7 +438,9 @@ static void read_ini_file(void) cmd.configdir = TRUE; } } +#endif /* G_OS_WIN32 */ +#if defined(G_OS_WIN32) || defined(__APPLE__) static void fix_font_setting(void) { const gchar *str = NULL; @@ -457,15 +459,24 @@ static void fix_font_setting(void) debug_print("fixing prefs_common.textfont setting\n"); +#ifdef G_OS_WIN32 str = "MS Gothic 12"; +#else /* __APPLE__ */ + str = "Hiragino Kaku Gothic Pro Light 13"; +#endif if (!gtkut_font_can_load(str)) { +#ifdef G_OS_WIN32 debug_print("font '%s' load failed\n", str); str = "\xef\xbc\xad\xef\xbc\xb3 \xe3\x82\xb4\xe3\x82\xb7\xe3\x83\x83\xe3\x82\xaf 12"; if (!gtkut_font_can_load(str)) { debug_print("font '%s' load failed\n", str); str = NULL; } +#else /* __APPLE__ */ + debug_print("font '%s' load failed\n", str); + str = NULL; +#endif } if (str) { |