home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!unisql!nandraj
- From: nandraj@unisql.UUCP (Nandraj Arni)
- Newsgroups: comp.windows.x.motif
- Subject: How to get names(char*) of colors and fonts?
- Message-ID: <3454@unisql.UUCP>
- Date: 17 Aug 92 22:44:00 GMT
- Reply-To: nandraj@unisql.UUCP (Nandraj Arni)
- Organization: UniSQL, Inc., Austin, Texas, USA
- Lines: 60
-
-
- I could not find a direct or indirect way to find names (char*)
- of fonts and colors. I was able to set it but not get it. Does
- anyone has any clue/solution/ideas? Here is what I tried to get the
- font name.......
-
-
- First method:
-
- >>>>>>>>>-------------------------------------------------------------
- char* get_font(Widget w)
- {
- XmFontList fontlist = NULL;
- XmFontContext context = NULL;
- XmStringCharSet* charset = NULL;
- XFontStruct **font = NULL;
- unsigned long name;
-
- XtVaGetValues(this->widget, XmNfontList, &fontlist, NULL);
-
- if (XmFontListInitFontContext(&context, fontlist)) {
- while(XmFontListGetNextFont(context, charset, font)) {
- if (font && *font) {
- XmFontListFreeFontContext(context);
- return(XmGetAtomName(XtDisplay(this->widget),
- (*font)->properties->name));
- }
- XtFree(charset);
- }
- XmFontListFreeFontContext(context);
- }
- XmFontListFree(fontlist);
- return(NULL);
- }
- >>>>>>>>>-------------------------------------------------------------
-
-
- Here is another try (also a failure..)
-
- >>>>>>>>>-------------------------------------------------------------
- char* get_font(Widget w)
- {
- return(XmGetAtomName(XtDisplay(w), XA_FONT_NAME));
- }
- >>>>>>>>>-------------------------------------------------------------
-
-
- Thanks for any help.....
-
- --
- *******************************************************************
- Nandraj Arni
-
- UniSQL, Inc. Voice: 512 343 7372 Ext. 107
- 9390 Research Blvd. Home: 512 794 9386
- Kaliedo II FAX: 512 343 7383
- Austin, TX 78759
-
- Email: unisql!nandraj@cs.utexas.edu
- *******************************************************************
-