[comp.windows.x] Default font

dshr@SUN.COM (David Rosenthal) (12/13/88)

Correction to my previous response:

> These are all bugs.  Anything that outputs characters using the default font
> is a bug.

I should have said:

Anything that outputs characters using the font it finds in a newly created GC
without checking that the attributes of the font are suitable is a bug.

Because:

-	there is no such thing as "the default font" (but its hard to stop
	using it :-)
-	if the attributes of the font you find in a newly created GC,
	including the encoding,  are suitable there is no harm in using
	that font.

At the same time,  the font naming mechanism in R3 is a much better solution
to these problems than trying to specify anything about the def (Oops!)
font you find in a newly created GC.

	David.

garya@stan.com (Gary Aitken) (12/13/88)

In thinking about it further, there is no reason you shouldn't be able
to do any operation you want with the default font.  One is allowed to
obtain the XFontStruct for a default font; from this structure and the font
properties one should be able to ascertain whether or not it is suitable.  In
particular, the FONT property contains information from which one can
determine whether or not the font has the proper ISO encoding.  Although,
unfortunately, the current "fixed" default font has a FONT property which
doesn't contain encoding info.  But one could easily add the 5 or so 
"nonconforming" fonts to the code which checked the font properties.

In light of this, wouldn't it solve a lot of problems if the server DID
allocate a font id for default fonts?  Is there any reason not to?  It
requires no protocol changes; the main problem as I see it is that the
fid member of the XFontStruct returned from an XQueryFont using a default
GC is currently a GC id, not a Font id.  Is this done for a purpose,
or is it a relic?

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (12/17/88)

    In light of this, wouldn't it solve a lot of problems if the server DID
    allocate a font id for default fonts?  Is there any reason not to?  It
    requires no protocol changes;

Yes, it would require a protocol change, in order for the server to
return the font id back to the client.

jsb@CS.BROWN.EDU (07/12/89)

The Xlib reference notes that the default value for the "font" field
of a GC is "<implementation dependent>" [scheifler p96].  Okay, but how
do I find out what it is?  All I need is a font id, but the obvious method:

	default_fid = (XQueryFont(dpy, my_gc_id))->fid;

doesn't work because, as the manual says, fid contains my_gc_id.

Is there any way to determine the font id of the default font?

John

rws@EXPO.LCS.MIT.EDU (Bob Scheifler) (07/13/89)

    Is there any way to determine the font id of the default font?

Nope.  Calling it the "default" font is probably a misnomer, it's more like
the "when all else fails, at least there's something to put in the GC" font.

rjh@udev.cdc.com (rick huebsch) (05/07/90)

I'm probably missing something obvious, but .....

If a user does not specify a font either through a resource
or on a command line, what is the default font used to display
text?  (seems to be "fixed")

What I'm really getting at is what is the best way for an Xt application
writer to supply a default font without supplying an application 
defaults file?


thanks,

-Rick      (rjh@udev.cdc.com)