summary refs log tree commit diff stats
path: root/src/common/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/common/util.c b/src/common/util.c
index cc5169c7..5980a791 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -32,6 +32,7 @@
 #include <sys/timeb.h>
 #include <process.h>
 #include <io.h>
+#include <pango/pangocairo.h>		/* for find_font() */
 #include "../dirent/dirent-win32.h"
 #include "../../config-win32.h"
 #else
@@ -1986,3 +1987,34 @@ encode_sasl_pass (char *user, char *pass)
 
 	return encoded;
 }
+
+#ifdef WIN32
+int
+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 1;
+		}
+	}
+
+	g_free (families);
+	return 0;
+}
+#endif