On Thu, 27 Sep 2007, Eeri Kask wrote:
Marc Aurele La France wrote:
[....] Concerning xft I believe having read Keith Packard
"sans", "serif" and "mono" should be expected included in every xft
installation, so I chose "sans-10" and "mono-10" as a replacement for
"variable" and "fixed" in twm.c.
This is the story to that decision. :-)
This can be remedied with the use of XListFonts().
I don't quite catch your suggestion, please help, be more specific. :-)
In InitVariables(), I'd have ...
/* setup default fonts; overridden by defaults from system.twmrc */
#define DEFAULT_NICE_FONT "variable"
#define DEFAULT_FAST_FONT "fixed"
#ifndef TWM_USE_XFT
Scr->TitleBarFont.fontset = NULL;
Scr->MenuFont.fontset = NULL;
Scr->IconFont.fontset = NULL;
Scr->SizeFont.fontset = NULL;
Scr->IconManagerFont.fontset = NULL;
Scr->DefaultFont.fontset = NULL;
#endif /* TWM_USE_XFT */
Scr->TitleBarFont.font = NULL;
Scr->TitleBarFont.name = DEFAULT_NICE_FONT;
Scr->MenuFont.font = NULL;
Scr->MenuFont.name = DEFAULT_NICE_FONT;
Scr->IconFont.font = NULL;
Scr->IconFont.name = DEFAULT_NICE_FONT;
Scr->SizeFont.font = NULL;
Scr->SizeFont.name = DEFAULT_FAST_FONT;
Scr->IconManagerFont.font = NULL;
Scr->IconManagerFont.name = DEFAULT_NICE_FONT;
Scr->DefaultFont.font = NULL;
Scr->DefaultFont.name = DEFAULT_FAST_FONT;
... and GetFont() would then look like ...
void
GetFont(font)
MyFont *font;
{
#ifdef TWM_USE_XFT
char **fontlist;
int listcount;
if (font->font != NULL)
XftFontClose(dpy, font->font);
fontlist = XListFonts(dpy, font->name, 1, &listcount);
if ((fontlist != NULL) && (listcount >= 1) &&
(fontlist[0] != NULL) && (fontlist[0][0] != 0))
font->font = XftFontOpenXlfd(dpy, Scr->screen, fontlist[0]);
else
font->font = XftFontOpenName (dpy, Scr->screen, font->name);
if (fontlist != NULL)
XFreeFontNames(fontlist);
if (font->font == NULL) {
char *deffontname = Scr->DefaultFont.name;
if (deffontname == NULL)
deffontname = "fixed";
fontlist = XListFonts(dpy, deffontname, 1, &listcount);
if ((fontlist != NULL) && (listcount >= 1) &&
(fontlist[0] != NULL) && (fontlist[0][0] != 0))
font->font = XftFontOpenXlfd(dpy, Scr->screen, fontlist[0]);
else
font->font = XftFontOpenName (dpy, Scr->screen, deffontname);
if (fontlist != NULL)
XFreeFontNames(fontlist);
if (font->font == NULL) {
fprintf (stderr, "%s: unable to open fonts \"%s\" or \"%s\"\n",
ProgramName, font->name, deffontname);
exit(1);
}
}
font->height = font->font->ascent + font->font->descent;
font->y = font->font->ascent;
font->ascent = font->font->ascent;
font->descent = font->font->descent;
#else
[...]
Marc.
+----------------------------------+----------------------------------+
| Marc Aurele La France | work: 1-780-492-9310 |
| Academic Information and | fax: 1-780-492-1729 |
| Communications Technologies | email: tsi@xxxxxxxxxxx |
| 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
Devel@xxxxxxxxxxx
http://XFree86.Org/mailman/listinfo/devel