eb3ec7d6b1817f674d302bbd18fea5d9b08a67c2
[gentoo.git] /
1 From c6753b750d76564bee02b317d10a496d0ced4274 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?R=C3=A9mi=20Cardona?= <remi@gentoo.org>
3 Date: Fri, 4 Sep 2009 23:05:29 +0200
4 Subject: [PATCH] dix: append "built-ins" to the font path in SetDefaultFontPath
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 49b93df8a3002db7196aa3fc1fd8dca1c12a55d6 made the hard dependency on
10 a "fixed" font go away but only Xorg could use the built-ins fonts by
11 default.
12
13 With this commit, all DDXs get "built-ins" appended to their FontPath, not
14 just Xorg.
15
16 Tested with Xorg, Xvfb and Xnest.
17
18 Signed-off-by: RĂ©mi Cardona <remi@gentoo.org>
19 ---
20  dix/dixfonts.c                 |   20 ++++++++++++++++++--
21  hw/xfree86/common/xf86Config.c |   16 ----------------
22  2 files changed, 18 insertions(+), 18 deletions(-)
23
24 diff --git a/dix/dixfonts.c b/dix/dixfonts.c
25 index 719bca4..4d69025 100644
26 --- a/dix/dixfonts.c
27 +++ b/dix/dixfonts.c
28 @@ -1818,6 +1818,9 @@ SetDefaultFontPath(char *path)
29      unsigned char *cp,
30                 *pp,
31                 *nump,
32 +               *temp_path,
33 +               *start,
34 +               *end,
35                 *newpath;
36      int         num = 1,
37                  len,
38 @@ -1825,12 +1828,24 @@ SetDefaultFontPath(char *path)
39                  size = 0,
40                  bad;
41  
42 +    /* ensure temp_path contains "built-ins" */
43 +    start = strstr(path, "built-ins");
44 +    end = start + strlen("built-ins");
45 +    if (start == NULL ||
46 +       !((start == path || start[-1] == ',') && (!*end || *end == ','))) {
47 +       temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : "");
48 +    } else {
49 +        temp_path = Xstrdup(path);
50 +    }
51 +    if (!temp_path)
52 +        return BadAlloc;
53 +
54      /* get enough for string, plus values -- use up commas */
55 -    len = strlen(path) + 1;
56 +    len = strlen(temp_path) + 1;
57      nump = cp = newpath = (unsigned char *) xalloc(len);
58      if (!newpath)
59         return BadAlloc;
60 -    pp = (unsigned char *) path;
61 +    pp = (unsigned char *) temp_path;
62      cp++;
63      while (*pp) {
64         if (*pp == ',') {
65 @@ -1849,6 +1864,7 @@ SetDefaultFontPath(char *path)
66      err = SetFontPathElements(num, newpath, &bad, TRUE);
67  
68      xfree(newpath);
69 +    xfree(temp_path);
70  
71      return err;
72  }
73 diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c
74 index 9376119..ddf4745 100644
75 --- a/hw/xfree86/common/xf86Config.c
76 +++ b/hw/xfree86/common/xf86Config.c
77 @@ -612,22 +612,6 @@ configFiles(XF86ConfFilesPtr fileconf)
78         pathFrom = X_DEFAULT;
79      temp_path = defaultFontPath ? defaultFontPath : "";
80  
81 -    /* ensure defaultFontPath contains "built-ins" */
82 -    start = strstr(temp_path, "built-ins");
83 -    end = start + strlen("built-ins");
84 -    if (start == NULL ||
85 -       !((start == temp_path || start[-1] == ',') && (!*end || *end == ','))) {
86 -       defaultFontPath = Xprintf("%s%sbuilt-ins",
87 -                                 temp_path, *temp_path ? "," : "");
88 -       if (must_copy == TRUE) {
89 -           if (defaultFontPath != NULL) {
90 -               must_copy = FALSE;
91 -           }
92 -       } else {
93 -           /* already made a copy of the font path */
94 -           xfree(temp_path);
95 -       }
96 -    }
97      /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */
98      temp_path = must_copy ? XNFstrdup(defaultFontPath) : defaultFontPath;
99      defaultFontPath = xf86ValidateFontPath(temp_path);
100 -- 
101 1.6.4.2
102