aboutsummaryrefslogtreecommitdiff
path: root/src/gtkutils.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-04-16 05:41:15 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2007-04-16 05:41:15 +0000
commit839719a70498485a26889ee86086e768ead87d1b (patch)
tree3cebaabeab426e1982639647da93b57438794499 /src/gtkutils.c
parent16de7229895d8c8da1ed334a2b638d1795c51626 (diff)
win32: check for the loadability of the default font.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1637 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/gtkutils.c')
-rw-r--r--src/gtkutils.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gtkutils.c b/src/gtkutils.c
index 585e75d3..9294587b 100644
--- a/src/gtkutils.c
+++ b/src/gtkutils.c
@@ -42,6 +42,10 @@
#include <stdlib.h>
#include <stdarg.h>
+#ifdef G_OS_WIN32
+# include <pango/pangowin32.h>
+#endif
+
#include "gtkutils.h"
#include "utils.h"
#include "codeconv.h"
@@ -106,6 +110,32 @@ void gtkut_widget_set_small_font_size(GtkWidget *widget)
pango_font_description_free(font_desc);
}
+gboolean gtkut_font_can_load(const gchar *str)
+{
+#ifdef G_OS_WIN32
+ PangoFontDescription *desc;
+ PangoContext *context;
+ PangoFont *font;
+ gboolean can_load = FALSE;
+
+ desc = pango_font_description_from_string(str);
+ if (desc) {
+ context = pango_win32_get_context();
+ 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
+}
+
void gtkut_convert_int_to_gdk_color(gint rgbvalue, GdkColor *color)
{
g_return_if_fail(color != NULL);