From 030a578391c634bc68add6ada3f251cf3f8c3069 Mon Sep 17 00:00:00 2001 From: David Nusinow Date: Thu, 3 May 2007 22:51:07 -0400 Subject: [PATCH] Provide UseDefaultFontPath option This provides a new option, UseDefaultFontPath. This option is enabled by default, and causes the X server to always append the default font path (defined at compile time) to the font path for the server. This will allow people to specify additional font paths if they want without breaking their font path, thus hopefully avoiding ye olde "fixed front" problem. Because this option is a ServerFlag option, the ServerFlags need to be processed before the files section of the config file, so swap the order that they are processed. --- hw/xfree86/common/xf86Config.c | 30 ++++++++++++++++++++++------ hw/xfree86/common/xf86Privstr.h | 2 ++ hw/xfree86/doc/man/xorg.conf.man.pre | 5 +++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 301b17c87..f44f042ef 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -604,16 +604,24 @@ configFiles(XF86ConfFilesPtr fileconf) 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) - defaultFontPath = f; - else { + if (*f) { + if (xf86Info.useDefaultFontPath) { + xf86Msg(X_WARNING, "Including the default font path %s.\n", defaultFontPath); + char *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; @@ -781,6 +789,7 @@ typedef enum { FLAG_AIGLX, FLAG_IGNORE_ABI, FLAG_ALLOW_EMPTY_INPUT, + FLAG_USE_DEFAULT_FONT_PATH } FlagValues; static OptionInfoRec FlagOptions[] = { @@ -856,6 +865,8 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_IGNORE_ABI, "IgnoreABI", OPTV_BOOLEAN, {0}, FALSE }, + { FLAG_USE_DEFAULT_FONT_PATH, "UseDefaultFontPath", OPTV_BOOLEAN, + {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; @@ -1055,6 +1066,13 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) if (xf86GetOptValBool(FlagOptions, FLAG_ALLOW_EMPTY_INPUT, &value)) xf86Info.allowEmptyInput = TRUE; + xf86Info.useDefaultFontPath = TRUE; + xf86Info.useDefaultFontPathFrom = X_DEFAULT; + if (xf86GetOptValBool(FlagOptions, FLAG_USE_DEFAULT_FONT_PATH, &value)) { + xf86Info.useDefaultFontPath = value; + xf86Info.useDefaultFontPathFrom = X_CONFIG; + } + /* Make sure that timers don't overflow CARD32's after multiplying */ #define MAX_TIME_IN_MIN (0x7fffffff / MILLI_PER_MIN) @@ -2490,9 +2508,9 @@ xf86HandleConfigFile(Bool autoconfig) /* Now process everything else */ - if (!configFiles(xf86configptr->conf_files) || - !configServerFlags(xf86configptr->conf_flags, + if (!configServerFlags(xf86configptr->conf_flags, xf86ConfigLayout.options) || + !configFiles(xf86configptr->conf_files) || !configExtensions(xf86configptr->conf_extensions) #ifdef XF86DRI || !configDRI(xf86configptr->conf_dri) diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 659e566e0..7ca0669a5 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -120,6 +120,8 @@ typedef struct { MessageType randRFrom; Bool aiglx; MessageType aiglxFrom; + Bool useDefaultFontPath; + MessageType useDefaultFontPathFrom; Bool ignoreABI; struct { Bool disabled; /* enable/disable deactivating diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man.pre index f96428287..f2cb5ef03 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man.pre @@ -604,6 +604,11 @@ the builtin handler will be used. .BI "Option \*qAIGLX\*q \*q" boolean \*q enable or disable AIGLX. AIGLX is enabled by default. .TP 7 +.BI "Option \*qUseDefaultFontPath\*q \*q" boolean \*q +Include the default font path even if other paths are specified in +xorg.conf. If enabled, other font paths are included as well. Enabled by +default. +.TP 7 .BI "Option \*qIgnoreABI\*q \*q" boolean \*q Allow modules built for a different, potentially incompatible version of the X server to load. Disabled by default.