summary refs log tree commit diff stats
path: root/src/fe-gtk/gtkutil.c
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-01-31 17:20:17 -0500
committerTingPing <tingping@tingping.se>2014-02-04 20:45:29 -0500
commit3a7fb4d8e1896eced87e3ccbf9369d76fa10d7e0 (patch)
tree444fe3085277bcc8a65f187991a874d0e794c0f6 /src/fe-gtk/gtkutil.c
parent8e55157e6abc105ee17d80d91a291ca8e1215733 (diff)
osx: Set Menlo as default font
This moves the find_font function to the front ends since it depends on
pango and cairo
Diffstat (limited to 'src/fe-gtk/gtkutil.c')
-rw-r--r--src/fe-gtk/gtkutil.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c
index 79b71233..282b952c 100644
--- a/src/fe-gtk/gtkutil.c
+++ b/src/fe-gtk/gtkutil.c
@@ -27,6 +27,9 @@
 #include "fe-gtk.h"
 
 #include <gdk/gdkkeysyms.h>
+#if defined (WIN32) || defined (__APPLE__)
+#include <pango/pangocairo.h>
+#endif
 
 #include "../common/hexchat.h"
 #include "../common/fe.h"
@@ -722,3 +725,33 @@ gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...)
 	return has_selected;
 }
 
+#if defined (WIN32) || defined (__APPLE__)
+gboolean
+gtkutil_find_font (const char *fontname)
+{
+	int i;
+	int n_families;
+	const char *family_name;
+	PangoFontMap *fontmap;
+	PangoFontFamily *family;
+	PangoFontFamily **families;
+
+	fontmap = pango_cairo_font_map_get_default ();
+	pango_font_map_list_families (fontmap, &families, &n_families);
+
+	for (i = 0; i < n_families; i++)
+	{
+		family = families[i];
+		family_name = pango_font_family_get_name (family);
+
+		if (!g_ascii_strcasecmp (family_name, fontname))
+		{
+			g_free (families);
+			return TRUE;
+		}
+	}
+
+	g_free (families);
+	return FALSE;
+}
+#endif