diff options
author | Rémi Cardona <remi@gentoo.org> | 2009-09-14 17:09:59 +0200 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-16 11:44:08 +1000 |
commit | f56cbe1ef24415d0142b9a7d0ab0a031069ccb52 (patch) | |
tree | 609015dba4060e22e5df1547fb16ee299d14ffe3 /dix/dixfonts.c | |
parent | 139368f7ae192b592e24d013e8ca5ce4175effe1 (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.
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>
Diffstat (limited to 'dix/dixfonts.c')
-rw-r--r-- | dix/dixfonts.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 7d7ae71de..d0a46c744 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -1810,6 +1810,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, @@ -1820,12 +1823,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; + 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 == ',') { @@ -1844,6 +1866,7 @@ SetDefaultFontPath(char *path) err = SetFontPathElements(num, newpath, &bad, TRUE); xfree(newpath); + xfree(temp_path); return err; } |