[comp.windows.x] How to change font using toolkit

swick@ATHENA.MIT.EDU (Ralph R. Swick) (08/29/88)

     Date:  26 Aug 88 22:31:08 GMT
     From:  okstate!romed!drd!mark@rutgers.edu  (Mark Lawrence)

     Would some kind soul please send me a snippet of code that illustrates
     how a font gets changed in a program that uses Xtoolkit.

If you're changing the font for a widget before it is created, you
should arrange for the appropriate resource specification to be added
to your resource database (e.g. via xrdb).  If you're changing the font
for a widget after it has been created, you should use XtSetValues.

     Is the XtConvert routine what I want?  The widget documentation says
     that setting XtNfont requires an argument of type FontInfo*.  Where is
     that defined?

The documentation for Xaw is in error.  The correct data type is
XFontStruct*.  You can use the resource type conversion machinery
to obtain one of these, if you wish; simply declare an application
resource of type XtRFontStruct and then the string-to-fontstruct
conversion will be called automatically when/if necessary.