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 | |
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>
-rw-r--r-- | dix/dixfonts.c | 27 | ||||
-rw-r--r-- | hw/xfree86/common/xf86Config.c | 16 |
2 files changed, 25 insertions, 18 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) | |||
1810 | int | 1810 | int |
1811 | SetDefaultFontPath(char *path) | 1811 | SetDefaultFontPath(char *path) |
1812 | { | 1812 | { |
1813 | char *temp_path, | ||
1814 | *start, | ||
1815 | *end; | ||
1813 | unsigned char *cp, | 1816 | unsigned char *cp, |
1814 | *pp, | 1817 | *pp, |
1815 | *nump, | 1818 | *nump, |
@@ -1820,12 +1823,31 @@ SetDefaultFontPath(char *path) | |||
1820 | size = 0, | 1823 | size = 0, |
1821 | bad; | 1824 | bad; |
1822 | 1825 | ||
1826 | /* ensure temp_path contains "built-ins" */ | ||
1827 | start = path; | ||
1828 | while (1) { | ||
1829 | start = strstr(start, "built-ins"); | ||
1830 | if (start == NULL) | ||
1831 | break; | ||
1832 | end = start + strlen("built-ins"); | ||
1833 | if ((start == path || start[-1] == ',') && (!*end || *end == ',')) | ||
1834 | break; | ||
1835 | start = end; | ||
1836 | } | ||
1837 | if (!start) { | ||
1838 | temp_path = Xprintf("%s%sbuilt-ins", path, *path ? "," : ""); | ||
1839 | } else { | ||
1840 | temp_path = Xstrdup(path); | ||
1841 | } | ||
1842 | if (!temp_path) | ||
1843 | return BadAlloc; | ||
1844 | |||
1823 | /* get enough for string, plus values -- use up commas */ | 1845 | /* get enough for string, plus values -- use up commas */ |
1824 | len = strlen(path) + 1; | 1846 | len = strlen(temp_path) + 1; |
1825 | nump = cp = newpath = xalloc(len); | 1847 | nump = cp = newpath = xalloc(len); |
1826 | if (!newpath) | 1848 | if (!newpath) |
1827 | return BadAlloc; | 1849 | return BadAlloc; |
1828 | pp = (unsigned char *) path; | 1850 | pp = (unsigned char *) temp_path; |
1829 | cp++; | 1851 | cp++; |
1830 | while (*pp) { | 1852 | while (*pp) { |
1831 | if (*pp == ',') { | 1853 | if (*pp == ',') { |
@@ -1844,6 +1866,7 @@ SetDefaultFontPath(char *path) | |||
1844 | err = SetFontPathElements(num, newpath, &bad, TRUE); | 1866 | err = SetFontPathElements(num, newpath, &bad, TRUE); |
1845 | 1867 | ||
1846 | xfree(newpath); | 1868 | xfree(newpath); |
1869 | xfree(temp_path); | ||
1847 | 1870 | ||
1848 | return err; | 1871 | return err; |
1849 | } | 1872 | } |
diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index e81eb0f63..82c39939e 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c | |||
@@ -614,22 +614,6 @@ configFiles(XF86ConfFilesPtr fileconf) | |||
614 | pathFrom = X_DEFAULT; | 614 | pathFrom = X_DEFAULT; |
615 | temp_path = defaultFontPath ? defaultFontPath : ""; | 615 | temp_path = defaultFontPath ? defaultFontPath : ""; |
616 | 616 | ||
617 | /* ensure defaultFontPath contains "built-ins" */ | ||
618 | start = strstr(temp_path, "built-ins"); | ||
619 | end = start + strlen("built-ins"); | ||
620 | if (start == NULL || | ||
621 | !((start == temp_path || start[-1] == ',') && (!*end || *end == ','))) { | ||
622 | defaultFontPath = Xprintf("%s%sbuilt-ins", | ||
623 | temp_path, *temp_path ? "," : ""); | ||
624 | if (must_copy == TRUE) { | ||
625 | if (defaultFontPath != NULL) { | ||
626 | must_copy = FALSE; | ||
627 | } | ||
628 | } else { | ||
629 | /* already made a copy of the font path */ | ||
630 | xfree(temp_path); | ||
631 | } | ||
632 | } | ||
633 | /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */ | 617 | /* xf86ValidateFontPath modifies its argument, but returns a copy of it. */ |
634 | temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath; | 618 | temp_path = must_copy ? xnfstrdup(defaultFontPath) : defaultFontPath; |
635 | defaultFontPath = xf86ValidateFontPath(temp_path); | 619 | defaultFontPath = xf86ValidateFontPath(temp_path); |