jordan@ADS.COM (Jordan Hayes) (10/20/88)
If I create a Text Widget, how do I specify the font?
Here's what I do (ignoring error checking for clarity :-):
int n;
Arg args[10];
Widget root, form, label;
XFontStruct *fi;
/* assume you have a form already made (or a box or ...) */
n = 0;
fi = XLoadQueryFont(XtDisplay(root), "vctl-25");
XtSetArg(args[n], XtNfont, (XtArgVal)fi); n++;
XtCreateManagedWidget("A Label", labelWidgetClass, form, args, n);
/jordanswick@ATHENA.MIT.EDU (Ralph R. Swick) (10/20/88)
The easiest way (to work around the documenation bugs and the implementation deficiencies) is to make sure your resource database contains an entry (of type String) for the font resource: *Text*Font: variable or *TextSink.Font: variable Jordan Hayes shows the correct way to pass an XFontStruct* in the arglist, but not the best way to get it.
swick@ATHENA.MIT.EDU (Ralph R. Swick) (10/20/88)
> XtCreateManagedWidget("A Label", labelWidgetClass, form, args, n);
Using whitespace within a widget name is poor form; it makes it very
difficult to specify resources for that widget instance through
a resource file.