On Fri, 28 Sep 2007, Eeri Kask wrote:

As quick answer, I'd take two good ideas from you suggestion instantly:

(1) Use XListFonts() instead of XLoadQueryFont() to test if a font is

No.  It is to test if it is a "core" font.

(2) Use DefaultFont as a first fallback if requested font could not be
loaded. (I don't know if it makes sense to give a stderr warning that
the requested font could not be found and a replacement was needed?)

The !defined(TWM_USE_XFT) case doesn't.  Both cases should be consistent.

Regarding the issue of "fixed"/"variable" <--> "mono-10"/"sans-10"  I'd
suggest to find out how XftFontOpenXlfd() is per definition _supposed_
to work if called with "fixed" or "variable".  Now my installed Xft
library crashes twm in whole;  but irrespective to that, if
XftFontOpenXlfd() is supposed or is free to choose a random replacement
(as not being able to load "fixed" for example), then initialising to
"mono-10" instead of "fixed" makes sense as the outcome to the user is
kind of more deterministic.  This is a matter of opinion/taste, and in
the end a minor issue.

The point of using XListFonts() is that it'll resolve "fixed" & "variable" to their respective XLFDs which can then be passed to XftFontOpenXlfd().

MyFont *font;
#ifdef TWM_USE_XFT

     char **fontlist;
     int listcount;

     if (font->font != NULL)
        XftFontClose(dpy, font->font);

GetFont() is only called on screen initialisation in CreateFonts() and
the font->font variable is priorly initialised to NULL; this is
guaranteed.  So the 'if' test here --- if passing --- would hide some
programming error somewhere else, if I am correct...  :-)

Again, look at the !defined(TWM_USE_XFT) code.


|  Marc Aurele La France           |  work:   1-780-492-9310          |
|  Academic Information and        |  fax:    1-780-492-1729          |
|    Communications Technologies   |  email:  [EMAIL PROTECTED]         |
|  352 General Services Building   +----------------------------------+
|  University of Alberta           |                                  |
|  Edmonton, Alberta               |    Standard disclaimers apply    |
|  T6G 2H1                         |                                  |
|  CANADA                          |                                  |
XFree86 developer and VP.  ATI driver and X server internals.
Devel mailing list

Reply via email to