summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Cardona <remi@gentoo.org>2009-09-14 17:09:59 +0200
committerKeith Packard <keithp@keithp.com>2009-09-22 12:14:56 -0700
commitc3d182a47902d02f9e64f933b8565ae336f73f54 (patch)
tree8b8cb87b883e4ba05efcbd28d437d675215dc713
parent9bc4a69040493e589a3811ca5e085e323438996d (diff)
dix: append "built-ins" to the font path in SetDefaultFontPath
49b93df8a3002db7196aa3fc1fd8dca1c12a55d6 made the hard dependency on a "fixed" font go away but only Xorg could use the built-ins fonts by default. With this commit, all DDXs get "built-ins" appended to their FontPath, not just Xorg. Tested with Xorg, Xvfb and Xnest. (cherry picked from commit f56cbe1ef24415d0142b9a7d0ab0a031069ccb52) Signed-off-by: Rémi Cardona <remi@gentoo.org> Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Tested-by: Jon TURNEY <jon.turney@dronecode.org.uk> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--dix/dixfonts.c29
-rw-r--r--hw/xfree86/common/xf86Config.c16
2 files changed, 26 insertions, 19 deletions
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 719bca469..174372e93 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1815,6 +1815,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
int
SetDefaultFontPath(char *path)
{
+ char *temp_path,
+ *start,
+ *end;
unsigned char *cp,
*pp,
*nump,
@@ -1825,12 +1828,31 @@ SetDefaultFontPath(char *path)
size = 0,
bad;
+ /* ensure temp_path contains "built-ins" */
+ start = path;
+ while (1) {
+ start = strstr(start, "built-ins");
+ if (start == NULL)
+ break;
+ end = start + strlen("built-ins");
+ if ((start == path || start[-1] == ',') && (!*end || *end == ','))
+ break;
+ start = end;
+ }
+ if (!start) {
+ temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
+ } else {
+ temp_path = Xstrdup(path);
+ }
+ if (!temp_path)
+ return BadAlloc;
+
/* get enough for string, plus values -- use up commas */
- len = strlen(path) + 1;
- nump = cp = newpath = (unsigned char *) xalloc(len);
+ len = strlen(temp_path) + 1;
+ nump = cp = newpath = xalloc(len);
if (!newpath)
return BadAlloc;
- pp = (unsigned char *) path;
+ pp = (unsigned char *) temp_path;
cp++;
while (*pp) {
if (*pp == ',') {
@@ -1849,6 +1871,7 @@ SetDefaultFontPath(char *path)
err = SetFontPathElements(num, newpath, &bad, TRUE);
xfree(newpath);
+ xfree(temp_path);
return err;
}
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
index 93761193e..ddf474522 100644
--- a/hw/xfree86/common/xf86Config.c
+++ b/hw/xfree86/common/xf86Config.c
@@ -612,22 +612,6 @@ configFiles(XF86ConfFilesPtr fileconf)
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 ? "," : "");
- if (must_copy == TRUE) {
- if (defaultFontPath != NULL) {
- must_copy = FALSE;
- }
- } else {
- /* already made a copy of the font path */
- xfree(temp_path);
- }
- }
/* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
temp_path = must_copy ? XNFstrdup(defaultFontPath) : defaultFontPath;
defaultFontPath = xf86ValidateFontPath(temp_path);