[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 18:10:50 PST 2009


Paulo César Pereira de Andrade wrote:
> [...]
>>> A more complete patch is warranted, but perhaps just forcing built-ins
>>> as the last entry of the fontpath is sufficient?
>
>   Updated, simpler and more reliable, patch attached.
> (patch name also change)

  Sorry for replying myself (twice).

  There is a small bug in the patch (consider it an exercise for
the careful patch reviewer :-). The proper patch is
s/temp_path != defaultFontPath/temp_path == defaultFontPath/

  It could also be simplified to always add "built-ins" at
the end of defaultFontPath, but better to check, to have a
properly formated log message without possibly duplicated
entries.

  The constructs *possibly_null+n and foo = function(foo)
are correct and reliable C code (as possibly_null is not
deferenced if it is null), but it can also be modified to
use temporary variables and/or "if" blocks for easier
reading.
  It also assumes defaultFontPath is never NULL, what is
currently true, but code semantic may change in the future.

  Functions of libXfont without an installed header file
probably should be added to some *priv.h header, instead
of having prototypes in either .c or XServer sdk headers.

  This is not the only case, but maybe defaultFontPath
initialization should be something like:
defaultFontPath = xstrdup(define_value);
and
defaultFontPath = xstrdup(argv[i]);
so that it could be safely free'd before assigning a new
value, otherwise you need to live with these "small" leaks.
(self "advertising": I have an unfinished project, using a
specialized, C like language, that generates C source code
as output, and handles these kinds of things by using a
garbage collector, runtime type and object size information,
bounds checking, etc...).

Thanks for reading,
Paulo




More information about the xorg mailing list