summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorM Joonas Pihlaja <jpihlaja@cc.helsinki.fi>2011-02-18 15:44:08 +0200
committerM Joonas Pihlaja <jpihlaja@cc.helsinki.fi>2011-02-18 17:24:19 +0200
commitb6b430f2d6f9c1be4955a03853d0b7c7b2de262d (patch)
tree4f09fa2d664b2ccd63717c282a6719e05183dc25
parent04eda70d4f09f95bdd61b4844bfa46011d686ed7 (diff)
Add Denemo's font dir to fontconfig's default config.
If the user installs to a prefix the system fontconfig doesn't know about then when Denemo runs from that prefix it can't find its fonts. This patch adds Denemo's fonts dir to the fontconfig default configuration so that the user doesn't have to teach fontconfig about Denemo.
-rw-r--r--configure.in4
-rw-r--r--src/main.c2
-rw-r--r--src/utils.c3
3 files changed, 8 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index 5556a558..34662f79 100644
--- a/configure.in
+++ b/configure.in
@@ -46,6 +46,10 @@ PKG_CHECK_MODULES(RSVG, librsvg-2.0 >= 2.0)
CFLAGS="$CFLAGS $RSVG_CFLAGS"
LIBS="$LIBS $RSVG_LIBS"
+PKG_CHECK_MODULES(FONTCONFIG, fontconfig >= 2.2.0)
+CFLAGS="$CFLAGS $FONTCONFIG_CFLAGS"
+LIBS="$LIBS $FONTCONFIG_LIBS"
+
AC_ARG_ENABLE(
jack,
AC_HELP_STRING([--enable-jack], [use JACK @<:@default=no@:>@]),
diff --git a/src/main.c b/src/main.c
index 051efac5..8d978c4f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -489,6 +489,8 @@ main (int argc, char *argv[])
add_font_directory(fontpath);
fontpath = g_build_filename (prefix, "share", "fonts", "truetype","denemo", "denemo.ttf", NULL);
add_font_directory(fontpath);
+#else
+ add_font_directory (DATAROOTDIR "/fonts");
#endif
GError *error = NULL;
/* gtk initialization */
diff --git a/src/utils.c b/src/utils.c
index b8e1c7b1..1b4ab1f6 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <string.h> /*for SIGTERM */
+#include <fontconfig/fontconfig.h>
#include <gtk/gtk.h>
#include "accwidths.h"
#include <denemo/denemo.h>
@@ -29,7 +30,7 @@ void add_font_directory(gchar *fontpath) {
#ifdef G_OS_WIN32
AddFontResource(fontpath);
#else
- ;
+ FcConfigAppFontAddDir(NULL, fontpath);
#endif
}