summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
authorManish Singh <yosh@gimp.org>2001-11-24 21:34:58 +0000
committerManish Singh <yosh@src.gnome.org>2001-11-24 21:34:58 +0000
commit05ab07e19ac7ee4caedf9a4d4db762921ccf5f35 (patch)
treebf9639247a037c47b9fc9d2b0e8cdd30431b2ecb /pango
parent54d0b867ef0291528b49472ee397e80785df6f4f (diff)
downloadpango-05ab07e19ac7ee4caedf9a4d4db762921ccf5f35.tar.gz
acconfig.h support for --with-xftconfig-dir= path to system XftConfig file
2001-11-24 Manish Singh <yosh@gimp.org> * acconfig.h * configure.in: support for --with-xftconfig-dir= path to system XftConfig file * pango/pango-utils.c * pango/pangox.c: include "config.h", not <config.h> * pango/pangoxft-fontmap.c: this file is pangoxft-fontmap.c, not pangoxft-fontmap.h :) * pango/mini-xft/minixftint.h * pango/mini-xft/minixftinit.c: add code for searching common locations for the XftConfig file. We search MINI_XFTCONFIG_DIR if configure defines it for us (as above), then $sysconfdir, then (only on !_WIN32) /etc/X11 and /usr/X11R6/lib/X11.
Diffstat (limited to 'pango')
-rw-r--r--pango/mini-xft/minixftinit.c58
-rw-r--r--pango/mini-xft/minixftint.h9
-rw-r--r--pango/pango-utils.c2
-rw-r--r--pango/pangox.c2
-rw-r--r--pango/pangoxft-fontmap.c2
5 files changed, 49 insertions, 24 deletions
diff --git a/pango/mini-xft/minixftinit.c b/pango/mini-xft/minixftinit.c
index 627e9ad1..c055ed34 100644
--- a/pango/mini-xft/minixftinit.c
+++ b/pango/mini-xft/minixftinit.c
@@ -24,9 +24,7 @@
#include <stdlib.h>
-#ifdef _WIN32
-#include <stdio.h>
-#endif
+#include <glib.h>
#include "minixftint.h"
@@ -43,7 +41,7 @@ MiniXftInit (char *config)
{
config = getenv ("XFT_CONFIG");
if (!config)
- config = XFT_DEFAULT_PATH;
+ config = mini_xft_get_default_path ();
}
if (MiniXftConfigLexFile (config))
{
@@ -52,22 +50,56 @@ MiniXftInit (char *config)
return True;
}
-#ifdef _WIN32
+extern char *pango_get_sysconf_subdirectory (void);
+
+#ifdef MINI_XFTCONFIG_DIR
+#define SYSCONF_INDEX 1
+#else
+#define SYSCONF_INDEX 0
+#endif
+
char *
-get_xft_default_path (void)
+mini_xft_get_default_path (void)
{
static char *result = NULL;
- extern char *pango_get_sysconf_subdirectory (void);
- char *p;
-
+ char *paths[] = {
+#ifdef MINI_XFTCONFIG_DIR
+ MINI_XFTCONFIG_DIR,
+#endif
+ NULL,
+#ifndef _WIN32
+ "/etc/X11",
+ "/usr/X11R6/lib/X11"
+#endif
+ };
+ int i;
+ gboolean found = FALSE;
+
if (result)
return result;
- p = pango_get_sysconf_subdirectory ();
- result = malloc (strlen (p) + 20);
+ paths[SYSCONF_INDEX] = g_build_path (G_DIR_SEPARATOR_S,
+ pango_get_sysconf_subdirectory (),
+ "..",
+ NULL);
- sprintf (result, "%s\\..\\XftConfig", p);
+ for (i = 0; i < (sizeof(paths) / sizeof(paths[0])); i++)
+ {
+ if (result)
+ g_free (result);
+
+ result = g_build_filename (paths[i], "XftConfig", NULL);
+
+ if (g_file_test (result, G_FILE_TEST_EXISTS))
+ {
+ found = TRUE;
+ break;
+ }
+ }
+
+ if (!found)
+ g_warning ("Could not find XftConfig file");
+ g_free (paths[SYSCONF_INDEX]);
return result;
}
-#endif
diff --git a/pango/mini-xft/minixftint.h b/pango/mini-xft/minixftint.h
index f6e75768..1884f410 100644
--- a/pango/mini-xft/minixftint.h
+++ b/pango/mini-xft/minixftint.h
@@ -58,14 +58,7 @@ extern MiniXftFontSet *_MiniXftFontSet;
#define XFT_NMISSING 256
-#ifndef XFT_DEFAULT_PATH
-#ifndef _WIN32
-#define XFT_DEFAULT_PATH "/usr/X11R6/lib/X11/XftConfig"
-#else
-extern char *get_xft_default_path (void);
-#define XFT_DEFAULT_PATH get_xft_default_path ()
-#endif
-#endif
+extern char *mini_xft_get_default_path (void);
#define XFT_DBG_OPEN 1
#define XFT_DBG_OPENV 2
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 587a286d..7ef78746 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -24,7 +24,7 @@
#include <string.h>
#include <stdlib.h>
-#include <config.h>
+#include "config.h"
#include "pango-font.h"
#include "pango-utils.h"
diff --git a/pango/pangox.c b/pango/pangox.c
index dd16ae19..5200e6fa 100644
--- a/pango/pangox.c
+++ b/pango/pangox.c
@@ -34,7 +34,7 @@
#define PANGO_LIGATURE_HACK_DEBUG
-#include <config.h>
+#include "config.h"
#define PANGO_TYPE_X_FONT (pango_x_font_get_type ())
#define PANGO_X_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_X_FONT, PangoXFont))
diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c
index 0c1d3d64..3ca383b5 100644
--- a/pango/pangoxft-fontmap.c
+++ b/pango/pangoxft-fontmap.c
@@ -1,5 +1,5 @@
/* Pango
- * pangoxft-fontmap.h: Xft font handling
+ * pangoxft-fontmap.c: Xft font handling
*
* Copyright (C) 2000 Red Hat Software
*