Path: utzoo!attcan!uunet!mcsun!ukc!harrier.ukc.ac.uk!rlh2 From: rlh2@ukc.ac.uk (R.L.Hesketh) Newsgroups: comp.windows.x Subject: Re: How do you set widget fonts with XtSetArg? Message-ID: <5013@harrier.ukc.ac.uk> Date: 29 Jun 90 13:39:28 GMT References: Reply-To: rlh2@ukc.ac.uk (Richard Hesketh) Distribution: comp Organization: Computing Lab, University of Kent at Canterbury, UK. Lines: 49 In article roy@neptune.iex.com (Roy Cantu) writes: >However, the most recent problem involves fonts. I have yet to >uncover a method of setting widget fonts using XtSetArg. For >example, the Athena Label widget possesses the attribute XtNfont >which I would like to set as such: > > i = 0; > XtSetArg(args[i], XtNfont, ?????); i++; > XtSetValues(label_widget, args, i); > >But what belongs in the ??????? a pointer to an XFontStruct (documented as just "XFontStruct" not "XFontStruct *" in the Xaw manual). This can be found in R3 using the following .. XFontStruct *afont; afont = XLoadQueryFont(XtDisplay(label_widget), "-adobe-helvetica-hold-o-normal--24-240-75-75-p-138-iso8859-1"); if (afont != NULL) { i = 0; XtSetArg(args[i], XtNfont, afont); i++; XtSetValues(label_widget, args, i); } or even better in R4 ... String font_name = "-adobe-helvetica-hold-o-normal--24-240-75-75-p-138-iso8859-1"; XtVaSetValues(label_widget, XtVaTypedArg, XtNfont, XtRString, font_name, strlen(font_name), NULL); using the R4 varargs interface in Xt which calls the StringToFontStruct converter. >Thank you, thats ok >roy Richard Hesketh : @nsfnet-relay.ac.uk:rlh2@ukc.ac.uk : rlh2@ukc.ac.uk ..!mcsun!ukc!rlh2 --- Computing Lab., University of Kent at Canterbury, Canterbury, Kent, CT2 7NF, United Kingdom. Tel: +44 227 764000 ext 3682/7620