dix: append "built-ins" to the font path in SetDefaultFontPath
49b93df8a3
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.
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>
This commit is contained in:
parent
139368f7ae
commit
f56cbe1ef2
|
@ -1810,6 +1810,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error)
|
||||||
int
|
int
|
||||||
SetDefaultFontPath(char *path)
|
SetDefaultFontPath(char *path)
|
||||||
{
|
{
|
||||||
|
char *temp_path,
|
||||||
|
*start,
|
||||||
|
*end;
|
||||||
unsigned char *cp,
|
unsigned char *cp,
|
||||||
*pp,
|
*pp,
|
||||||
*nump,
|
*nump,
|
||||||
|
@ -1820,12 +1823,31 @@ SetDefaultFontPath(char *path)
|
||||||
size = 0,
|
size = 0,
|
||||||
bad;
|
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 */
|
/* get enough for string, plus values -- use up commas */
|
||||||
len = strlen(path) + 1;
|
len = strlen(temp_path) + 1;
|
||||||
nump = cp = newpath = xalloc(len);
|
nump = cp = newpath = xalloc(len);
|
||||||
if (!newpath)
|
if (!newpath)
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
pp = (unsigned char *) path;
|
pp = (unsigned char *) temp_path;
|
||||||
cp++;
|
cp++;
|
||||||
while (*pp) {
|
while (*pp) {
|
||||||
if (*pp == ',') {
|
if (*pp == ',') {
|
||||||
|
@ -1844,6 +1866,7 @@ SetDefaultFontPath(char *path)
|
||||||
err = SetFontPathElements(num, newpath, &bad, TRUE);
|
err = SetFontPathElements(num, newpath, &bad, TRUE);
|
||||||
|
|
||||||
xfree(newpath);
|
xfree(newpath);
|
||||||
|
xfree(temp_path);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -614,22 +614,6 @@ configFiles(XF86ConfFilesPtr fileconf)
|
||||||
pathFrom = X_DEFAULT;
|
pathFrom = X_DEFAULT;
|
||||||
temp_path = defaultFontPath ? defaultFontPath : "";
|
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. */
|
/* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
|
||||||
temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath;
|
temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath;
|
||||||
defaultFontPath = xf86ValidateFontPath(temp_path);
|
defaultFontPath = xf86ValidateFontPath(temp_path);
|
||||||
|
|
Loading…
Reference in New Issue