[PATCH] Set default font path with fontutil 1.1 and fontpath.d

Yaakov (Cygwin/X) yselkowitz at users.sourceforge.net
Thu Oct 15 20:40:02 PDT 2009


From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

Look for $sysconfdir/X11/fontpath.d and, if it exists, set it to the
default font path as a catalogue: entry. Based on app/xfs commit
c66a46e35ae40a23ad9acee838ab42300eddbd67.

Otherwise, use the font-util 1.1 macros to determine the system
fontrootdir and standard subdirectories, or let the user configure it
and the subdirectories themselves.

This adds a build-time (or at least an autoconf/autogen time) dependency
on font-util, and changes the --with-fontdir argument to --with-fontrootdir.

Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
---
 configure.ac |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index ed710f0..ce663a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,6 +36,9 @@ AM_MAINTAINER_MODE
 m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.3 or later before running autoconf/autogen])])
 XORG_MACROS_VERSION(1.3)
 
+m4_ifndef([XORG_FONT_MACROS_VERSION], [m4_fatal([must install fontutil 1.1 or later before running autoconf/autogen])])
+XORG_FONT_MACROS_VERSION(1.1)
+
 dnl this gets generated by autoheader, and thus contains all the defines.  we
 dnl don't ever actually use it, internally.
 AC_CONFIG_HEADERS(include/do-not-use-config.h)
@@ -487,13 +490,26 @@ AC_ARG_WITH(os-vendor,       AS_HELP_STRING([--with-os-vendor=OSVENDOR], [Name o
 AC_ARG_WITH(builderstring,   AS_HELP_STRING([--with-builderstring=BUILDERSTRING], [Additional builder string]),
 				[ BUILDERSTRING="$withval" ]
 				[ ])
-AC_ARG_WITH(fontdir,         AS_HELP_STRING([--with-fontdir=FONTDIR], [Path to top level dir where fonts are installed (default: ${libdir}/X11/fonts)]),
-                                [ FONTDIR="$withval" ],
-                                [ FONTDIR="${libdir}/X11/fonts" ])
-DEFAULT_FONT_PATH="${FONTDIR}/misc/,${FONTDIR}/TTF/,${FONTDIR}/OTF,${FONTDIR}/Type1/,${FONTDIR}/100dpi/,${FONTDIR}/75dpi/"
-case $host_os in
-	darwin*)    DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
-esac
+
+dnl Determine font path
+XORG_FONTROOTDIR
+XORG_FONTSUBDIR(FONTMISCDIR, fontmiscdir, misc)
+XORG_FONTSUBDIR(FONTOTFDIR, fontotfdir, OTF)
+XORG_FONTSUBDIR(FONTTTFDIR, fontttfdir, TTF)
+XORG_FONTSUBDIR(FONTTYPE1DIR, fonttype1dir, Type1)
+XORG_FONTSUBDIR(FONT75DPIDIR, font75dpidir, 75dpi)
+XORG_FONTSUBDIR(FONT100DPIDIR, font100dpidir, 100dpi)
+
+dnl Uses --default-font-path if set, otherwise checks for /etc/X11/fontpath.d,
+dnl otherwise uses standard subdirectories of FONTROOTDIR
+AC_CHECK_FILE([${sysconfdir}/X11/fontpath.d],
+	[DEFAULT_FONT_PATH='catalogue:$(sysconfdir)/X11/fontpath.d'],
+	[
+		DEFAULT_FONT_PATH="${FONTMISCDIR}/,${FONTTTFDIR}/,${FONTOTFDIR}/,${FONTTYPE1DIR}/,${FONT100DPIDIR}/,${FONT75DPIDIR}/"
+		case $host_os in
+			darwin*)    DEFAULT_FONT_PATH="${DEFAULT_FONT_PATH},/Library/Fonts,/System/Library/Fonts" ;;
+		esac
+	])
 AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [Comma separated list of font dirs]),
 				[ FONTPATH="$withval" ],
 				[ FONTPATH="${DEFAULT_FONT_PATH}" ])
@@ -1180,7 +1196,7 @@ fi
 AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path])
 AC_DEFINE_DIR(PCI_TXT_IDS_PATH, PCI_TXT_IDS_DIR, [Default PCI text file ID path])
 AC_DEFINE_DIR(SERVER_MISC_CONFIG_PATH, SERVERCONFIG, [Server miscellaneous config path])
-AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path])
+AC_DEFINE_DIR(BASE_FONT_PATH, FONTROOTDIR, [Default base font path])
 AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path])
 AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_NAME"], [Vendor name])
 AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_NAME_SHORT"], [Short vendor name])
-- 
1.6.4.2



More information about the xorg-devel mailing list