The attached patch changes the current XServer behaviour of using "built-ins" font by default only. But if the default font 'fixed' is not found, it will "automatically" default to use "built-ins" fonts.
I believe this is a far more reasonable default, and still addresses the "most common Xorg FAQ" in the same way. Paulo
>From 9c4dae9a69d1bfc2613ecfdf29b57d9870af4bee Mon Sep 17 00:00:00 2001 From: Paulo Cesar Pereira de Andrade <[email protected]> Date: Tue, 6 Jan 2009 15:07:57 -0200 Subject: [PATCH] Default to use standard fonts and builtin fonts as a fallback The builtin-fonts configure option was removed, as it at best should be a runtime option. Instead, if the XServer fails to load the default text font, fallback to use builtin fonts automatically. 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 | 4 -- dix/main.c | 8 ++++- hw/xfree86/common/xf86Config.c | 67 ++++++++++++++++------------------------ include/dixfont.h | 5 +++ 5 files changed, 39 insertions(+), 53 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..26ed89c 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -1906,12 +1906,8 @@ InitFonts (void) { patternCache = MakeFontPatternCache(); -#ifdef BUILTIN_FONTS - BuiltinRegisterFpeFunctions(); -#else FontFileRegisterFpeFunctions(); fs_register_fpe_functions(); -#endif } int diff --git a/dix/main.c b/dix/main.c index 4a062b7..c001a4f 100644 --- a/dix/main.c +++ b/dix/main.c @@ -331,7 +331,13 @@ int main(int argc, char *argv[], char *envp[]) ErrorF("[dix] failed to set default font path '%s'", defaultFontPath); } if (!SetDefaultFont(defaultTextFont)) { - FatalError("could not open default font '%s'", defaultTextFont); + LogMessage(X_WARNING, "Default font '%s' not found. " + "Using builtin fonts.\n", defaultTextFont); + BuiltinRegisterFpeFunctions(); + defaultFontPath = "built-ins"; + if (SetDefaultFontPath(defaultFontPath) != Success || + !SetDefaultFont(defaultTextFont)) + FatalError("could not open default font '%s'", defaultTextFont); } if (!(rootCursor = CreateRootCursor(NULL, 0))) { diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 48d8efd..9bf8dc1 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -610,17 +610,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,42 +643,38 @@ configFiles(XF86ConfFilesPtr fileconf) } } - /* If defaultFontPath is still empty, exit here */ - - if (! *defaultFontPath) - FatalError("No valid FontPath could be found."); - /* make fontpath more readable in the logfiles */ - countDirs = 1; - temp_path = defaultFontPath; - while((temp_path = index(temp_path, ',')) != NULL) { - countDirs++; - temp_path++; - } - log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1); - if(!log_buf) /* fallback to old method */ - xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath); - else { - char *start, *end; - int size; - temp_path = log_buf; - start = defaultFontPath; - while((end = index(start, ',')) != NULL) { - size = (end - start) + 1; + if (*defaultFontPath) { + countDirs = 1; + temp_path = defaultFontPath; + while((temp_path = index(temp_path, ',')) != NULL) { + countDirs++; + temp_path++; + } + log_buf = xnfalloc(strlen(defaultFontPath) + (2 * countDirs) + 1); + if(!log_buf) /* fallback to old method */ + xf86Msg(pathFrom, "FontPath set to \"%s\"\n", defaultFontPath); + else { + char *start, *end; + int size; + temp_path = log_buf; + start = defaultFontPath; + while((end = index(start, ',')) != NULL) { + size = (end - start) + 1; + *(temp_path++) = '\t'; + strncpy(temp_path, start, size); + temp_path += size; + *(temp_path++) = '\n'; + start += size; + } + /* copy last entry */ *(temp_path++) = '\t'; - strncpy(temp_path, start, size); - temp_path += size; - *(temp_path++) = '\n'; - start += size; - } - /* copy last entry */ - *(temp_path++) = '\t'; - strcpy(temp_path, start); - xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf); - xfree(log_buf); + strcpy(temp_path, start); + xf86Msg(pathFrom, "FontPath set to:\n%s\n", log_buf); + xfree(log_buf); + } } - if (fileconf && fileconf->file_inputdevs) { xf86InputDeviceList = fileconf->file_inputdevs; xf86Msg(X_CONFIG, "Input device list set to \"%s\"\n", 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
