[...]
>> A more complete patch is warranted, but perhaps just forcing built-ins
>> as the last entry of the fontpath is sufficient?

  Updated, simpler and more reliable, patch attached.
(patch name also change)

Paulo
>From 2e039dfaba142211ec9aa11fd0314b0e889d5669 Mon Sep 17 00:00:00 2001
From: Paulo Cesar Pereira de Andrade <[email protected]>
Date: Tue, 6 Jan 2009 20:34:30 -0200
Subject: [PATCH] Default to use standard bitmap fonts, with builtins as fallback

  The builtin-fonts configure option was removed, as it at best should
have been a runtime option. Instead, now it always register all "font
path element" backends, and adds built-ins fonts at the end of the
default font path.
  This should be a more reasonable solution, to "correct" the most
common Xorg FAQ (could not open default font 'fixed'), and also don't
break by default applications that use only the standard/historical
X Font rendering.
---
 configure.ac                   |    8 --------
 dix/dixfonts.c                 |    3 ---
 hw/xfree86/common/xf86Config.c |   25 ++++++++++++-------------
 include/dixfont.h              |    5 +++++
 4 files changed, 17 insertions(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9161cba..7bc6e5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -507,9 +507,6 @@ AC_ARG_ENABLE(install-libxf86config,
 				[Install libxf86config (default: disabled)]),
 				[INSTALL_LIBXF86CONFIG=$enableval],
 				[INSTALL_LIBXF86CONFIG=no])
-AC_ARG_ENABLE(builtin-fonts,  AS_HELP_STRING([--enable-builtin-fonts], [Use only built-in fonts (default: yes)]),
-                                [BUILTIN_FONTS=$enableval],
-                                [BUILTIN_FONTS=yes])
 AC_ARG_ENABLE(null-root-cursor, AS_HELP_STRING([--enable-null-root-cursor], [Use an empty root cursor (default: use core cursor)]),
                                  [NULL_ROOT_CURSOR=$enableval],
                                  [NULL_ROOT_CURSOR=no])
@@ -963,11 +960,6 @@ if test "x$DPMSExtension" = xyes; then
 	AC_DEFINE(DPMSExtension, 1, [Support DPMS extension])
 fi
 
-if test "x$BUILTIN_FONTS" = xyes; then
-       AC_DEFINE(BUILTIN_FONTS, 1, [Use only built-in fonts])
-       FONTPATH="built-ins"
-fi
-
 if test "x$XCALIBRATE" = xyes && test "$KDRIVE" = yes; then
    AC_DEFINE(XCALIBRATE, 1, [Build XCalibrate extension])
    REQUIRED_MODULES="$REQUIRED_MODULES xcalibrateproto"
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 15d011c..b0fbed2 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1906,12 +1906,9 @@ InitFonts (void)
 {
     patternCache = MakeFontPatternCache();
 
-#ifdef BUILTIN_FONTS
     BuiltinRegisterFpeFunctions();
-#else
     FontFileRegisterFpeFunctions();
     fs_register_fpe_functions();
-#endif
 }
 
 int
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 48d8efd..de984d4 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -590,6 +590,7 @@ configFiles(XF86ConfFilesPtr fileconf)
   int countDirs;
   char *temp_path;
   char *log_buf;
+  char *end;
 
   /* FontPath */
   /* Try XF86Config FontPath first */
@@ -610,17 +611,8 @@ configFiles(XF86ConfFilesPtr fileconf)
         } else {
           defaultFontPath = f;
         }
-      } else {
-	xf86Msg(X_WARNING,
-	    "FontPath is completely invalid.  Using compiled-in default.\n");
-        fontPath = NULL;
-        pathFrom = X_DEFAULT;
       }
     } 
-   } else {
-      xf86Msg(X_DEFAULT,
-	    "No FontPath specified.  Using compiled-in default.\n");
-      pathFrom = X_DEFAULT;
    }
   } else {
     /* Use fontpath specified with '-fp' */
@@ -652,10 +644,17 @@ configFiles(XF86ConfFilesPtr fileconf)
    }
   }
 
-  /* If defaultFontPath is still empty, exit here */
-
-  if (! *defaultFontPath)
-    FatalError("No valid FontPath could be found.");
+  temp_path = strstr(defaultFontPath, "built-ins");
+  end = temp_path + strlen("built-ins");
+  /* if "built-ins" not already in defaultFontPath */
+  if (temp_path == NULL ||
+      ((temp_path != defaultFontPath || temp_path[-1] != ',') &&
+       (!*end || *end != ',')))
+   /* defaultFontPath should really, by default, be initialized to a copy
+    * of COMPILEDDEFAULTFONTPATH, so that one would know it can free'd
+    * before assignment here... */
+    defaultFontPath = Xprintf("%s%sbuilt-ins", defaultFontPath,
+			      *defaultFontPath ? "," : "");
 
   /* make fontpath more readable in the logfiles */
   countDirs = 1;
diff --git a/include/dixfont.h b/include/dixfont.h
index 97bd712..fd44477 100644
--- a/include/dixfont.h
+++ b/include/dixfont.h
@@ -143,6 +143,11 @@ extern _X_EXPORT void InitGlyphCaching(void);
 extern _X_EXPORT void SetGlyphCachingMode(int /*newmode*/);
 
 /*
+ * libXfont/src/builtins/builtin.h
+ */ 
+extern _X_EXPORT void BuiltinRegisterFpeFunctions(void);
+
+/*
  * libXfont stubs.
  */
 extern _X_EXPORT int client_auth_generation(ClientPtr client);
-- 
1.6.0.5
_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to