Re: TWM: truetype support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> So, luckily we are now a step closed to the solution:  let's not use
>> 'fixed' as coded-in-default in twm.c if TWM_USE_XFT is defined, but
>> '-*-fixed-*-*-*-*-*-*-*-*-*-*-*-*', and neither XListFonts() nor
>> XftFontOpenXlfd() have any further difficulties!  (Is XListFonts()
>> supposed to translate font alias names at all?)  This looks a good idea,
>> in fact this is what you suggested first: let XListFonts() resolve
>> 'fixed' and then use it.  Now we know how to do that. :-)
> 
>> (As a backside, we then remove the flexibility in twm to use the
>> 'fixed'-alias-redirection to an arbitrary font.)
> 
> First, the X server does not even start if it cannot resolve 'fixed'.  In 
> that case, whether or not `twm` starts is a moot point.
> 
> Secondly, there are likely to be .twmrc's out there that specify other 
> aliases, such as '7x13' and so on.  Thus, it is important to fall back to a 
> raster font when Xft cannot resolve a font name, whether or not that name is 
> a default.  This makes it unnecessary to change twm's default font names.
> 
> Marc.


The good news is, Xft is hardly going to fail.

One can easily put "A quick brown fox jumps over the lazy dog" for
TitleFont into .twmrc as an amusing proof.  So if XLFD loading fails, we
will in fact never enter the "fallback" branch in util.c in GetFont().


But anyways, on our adventurous path to save "fixed" I'll put up a one
more proposition.   What about the following code fragment at the
beginning for GetFont() in util.c?   Now "fixed", "variable", "7x13" et
cetera are fine as font names.   :-)


----8<----8<----

void
GetFont(MyFont *font)
{
#ifdef TWM_USE_XFT

    XFontStruct *xlfd;
    Atom  atom;
    char *atom_name;

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

    /* test if core font: */
    xlfd = XLoadQueryFont (dpy, font->name);
    if (xlfd) {
	if (XGetFontProperty (xlfd, XA_FONT, &atom) == True) {
	    atom_name = XGetAtomName (dpy, atom);
	    if (atom_name) {
		font->font = XftFontOpenXlfd (dpy, Scr->screen, atom_name);
		XFree (atom_name);
	    }
	}
	XFreeFont (dpy, xlfd);
    }

    /* next, try Xft font: */
    if (font->font == NULL)
	font->font = XftFontOpenName (dpy, Scr->screen, font->name);

    /* fallback: */

    ....

----8<----8<----


Greetings,

    Eeri Kask
_______________________________________________
Devel mailing list
Devel@xxxxxxxxxxx
http://XFree86.Org/mailman/listinfo/devel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [X Forum]     [XFree86]     [XFree86 Newbie]     [X.Org]     [IETF Annouce]     [Security]     [Fontconfig]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]

  Powered by Linux