summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-07 19:37:03 -0200
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2009-01-07 19:37:03 -0200
commit49b93df8a3002db7196aa3fc1fd8dca1c12a55d6 (patch)
tree10e6be875a410b30842fed19cc551cea960663c2
parent4f004231871c830e16c4525cfaab183fad0aee86 (diff)
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.
-rw-r--r--configure.ac8
-rw-r--r--dix/dixfonts.c3
-rw-r--r--hw/xfree86/common/xf86Config.c134
-rw-r--r--include/dixfont.h5
4 files changed, 53 insertions, 97 deletions
diff --git a/configure.ac b/configure.ac
index 22a09b0d5..ae455de64 100644
--- a/configure.ac
+++ b/configure.ac
@@ -509,5 +509,2 @@ AC_ARG_ENABLE(install-libxf86config,
[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)]),
@@ -965,7 +962,2 @@ 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
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 15d011c1d..b0fbed232 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1908,8 +1908,5 @@ InitFonts (void)
-#ifdef BUILTIN_FONTS
BuiltinRegisterFpeFunctions();
-#else
FontFileRegisterFpeFunctions();
fs_register_fpe_functions();
-#endif
}
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 48d8efdb2..198b20f52 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -112,4 +112,2 @@ extern DeviceAssocRec mouse_assoc;
-static char *fontPath = NULL;
-
static ModuleDefault ModuleDefaults[] = {
@@ -588,86 +586,51 @@ configFiles(XF86ConfFilesPtr fileconf)
{
- MessageType pathFrom = X_DEFAULT;
- int countDirs;
- char *temp_path;
- char *log_buf;
-
- /* FontPath */
- /* Try XF86Config FontPath first */
- if (!xf86fpFlag) {
- if (fileconf) {
- if (fileconf->file_fontpath) {
- char *f = xf86ValidateFontPath(fileconf->file_fontpath);
- pathFrom = X_CONFIG;
- if (*f) {
- if (xf86Info.useDefaultFontPath) {
- char *g;
- xf86Msg(X_DEFAULT, "Including the default font path %s.\n", defaultFontPath);
- g = xnfalloc(strlen(defaultFontPath) + strlen(f) + 3);
- strcpy(g, f);
- strcat(g, ",");
- defaultFontPath = strcat(g, defaultFontPath);
- xfree(f);
- } 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' */
- if (fontPath)
- {
- fontPath = NULL;
+ MessageType pathFrom;
+ Bool must_copy;
+ int size, countDirs;
+ char *temp_path, *log_buf, *start, *end;
+
+ /* FontPath */
+ must_copy = TRUE;
+
+ temp_path = defaultFontPath ? defaultFontPath : "";
+ if (xf86fpFlag)
+ pathFrom = X_CMDLINE;
+ else if (fileconf && fileconf->file_fontpath) {
+ pathFrom = X_CONFIG;
+ if (xf86Info.useDefaultFontPath) {
+ defaultFontPath = Xprintf("%s%s%s",
+ fileconf->file_fontpath,
+ *temp_path ? "," : "", temp_path);
+ must_copy = FALSE;
+ }
+ else
+ defaultFontPath = fileconf->file_fontpath;
}
- pathFrom = X_CMDLINE;
- }
- if (!fileconf) {
- /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
- could be static, so we make a copy. */
- char *f = xnfalloc(strlen(defaultFontPath) + 1);
- f[0] = '\0';
- strcpy (f, defaultFontPath);
- defaultFontPath = xf86ValidateFontPath(f);
- xfree(f);
- } else {
- if (fileconf) {
- if (!fileconf->file_fontpath) {
- /* xf86ValidateFontPath will write into it's arg, but defaultFontPath
- could be static, so we make a copy. */
- char *f = xnfalloc(strlen(defaultFontPath) + 1);
- f[0] = '\0';
- strcpy (f, defaultFontPath);
- defaultFontPath = xf86ValidateFontPath(f);
- xfree(f);
- }
- }
- }
-
- /* 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;
+ else
+ pathFrom = X_DEFAULT;
+ temp_path = defaultFontPath ? defaultFontPath : "";
+
+ /* ensure defaultFontPath contains "built-ins" */
+ start = strstr(temp_path, "built-ins");
+ end = start + strlen("built-ins");
+ if (start == NULL ||
+ !((start == temp_path || start[-1] == ',') && (!*end || *end == ','))) {
+ defaultFontPath = Xprintf("%s%sbuilt-ins",
+ temp_path, *temp_path ? "," : "");
+ must_copy = FALSE;
+ }
+ /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
+ temp_path = must_copy ? XNFstrdup(defaultFontPath) : defaultFontPath;
+ defaultFontPath = xf86ValidateFontPath(temp_path);
+ free(temp_path);
+
+ /* 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);
temp_path = log_buf;
@@ -687,3 +650,2 @@ configFiles(XF86ConfFilesPtr fileconf)
xfree(log_buf);
- }
diff --git a/include/dixfont.h b/include/dixfont.h
index 97bd712ce..e444a2024 100644
--- a/include/dixfont.h
+++ b/include/dixfont.h
@@ -145,2 +145,7 @@ extern _X_EXPORT void SetGlyphCachingMode(int /*newmode*/);
/*
+ * libXfont/src/builtins/builtin.h
+ */
+extern _X_EXPORT void BuiltinRegisterFpeFunctions(void);
+
+/*
* libXfont stubs.