[PATCH] Default to use standard fonts and builtin fonts as a fallback

Paulo César Pereira de Andrade pcpa at mandriva.com.br
Tue Jan 6 14:39:33 PST 2009


James Cloos wrote:
> +1 on concept.
>
> I know some dists are using a simple patch such as:
>
> diff --git a/dix/dixfonts.c b/dix/dixfonts.c
> index 416adb3..719bca4 100644
> --- a/dix/dixfonts.c
> +++ b/dix/dixfonts.c
> @@ -1907,12 +1907,9 @@ InitFonts (void)
>  {
>      patternCache = MakeFontPatternCache();
>
> -#ifdef BUILTIN_FONTS
>      BuiltinRegisterFpeFunctions();
> -#else
>      FontFileRegisterFpeFunctions();
>      fs_register_fpe_functions();
> -#endif
>  }
>
>  int
>
> A more complete patch is warranted, but perhaps just forcing built-ins
> as the last entry of the fontpath is sufficient?

  You are right. I only really tried to understand the logic behind
it today, and made a "quick" patch.
  I will try another simpler patch, pseudo code:

dix/main.c:main.c()
...
     InitFonts();
+    str = strstr("built-ins", defaultFontPath);
+    end = str + strlen("built-ins");
+    if (str == null ||
+        ((str != defaultFontPath || str[-1] != ',') &&
+         (!*end || *end != ',')))
+        defaultFontPath = Xprintf("%s%sbuilt-ins", defaultFontPath,
+                                  *defaultFontPath ? "," : "");
     if (SetDefaultFontPath(defaultFontPath) != Success) {
...

  Will send a new version in a few minutes if it passes the
test cases. The other patch has a big problem, that if the
"default" font is not found, but a proper font path is already
set, it will disable the proper one...

> -JimC
> --
> James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6

Paulo




More information about the xorg mailing list