home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / windows / x / motif / 5670 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  2.0 KB

  1. Path: sparky!uunet!cs.utexas.edu!unisql!nandraj
  2. From: nandraj@unisql.UUCP (Nandraj Arni)
  3. Newsgroups: comp.windows.x.motif
  4. Subject: How to get names(char*) of colors and fonts?
  5. Message-ID: <3454@unisql.UUCP>
  6. Date: 17 Aug 92 22:44:00 GMT
  7. Reply-To: nandraj@unisql.UUCP (Nandraj Arni)
  8. Organization: UniSQL, Inc., Austin, Texas, USA
  9. Lines: 60
  10.  
  11.  
  12.      I could not find a direct or indirect way to find names (char*)
  13. of fonts and colors. I was able to set it but not get it. Does 
  14. anyone has any clue/solution/ideas? Here is what I tried to get the
  15. font name.......
  16.  
  17.  
  18. First method:
  19.  
  20. >>>>>>>>>-------------------------------------------------------------
  21. char* get_font(Widget w)
  22. {
  23.   XmFontList fontlist = NULL;
  24.   XmFontContext context = NULL;
  25.   XmStringCharSet* charset = NULL;
  26.   XFontStruct **font = NULL;
  27.   unsigned long name;
  28.  
  29.   XtVaGetValues(this->widget, XmNfontList, &fontlist, NULL); 
  30.   
  31.   if (XmFontListInitFontContext(&context, fontlist)) {
  32.     while(XmFontListGetNextFont(context, charset, font)) {
  33.       if (font && *font) {
  34.     XmFontListFreeFontContext(context);
  35.     return(XmGetAtomName(XtDisplay(this->widget),
  36.                  (*font)->properties->name));
  37.       }
  38.       XtFree(charset);
  39.     }
  40.     XmFontListFreeFontContext(context);
  41.   }
  42.   XmFontListFree(fontlist);
  43.   return(NULL);
  44. }
  45. >>>>>>>>>-------------------------------------------------------------
  46.  
  47.  
  48. Here is another try (also a failure..)
  49.  
  50. >>>>>>>>>-------------------------------------------------------------  
  51. char* get_font(Widget w)
  52. {
  53.   return(XmGetAtomName(XtDisplay(w), XA_FONT_NAME));
  54. }
  55. >>>>>>>>>-------------------------------------------------------------
  56.  
  57.  
  58. Thanks for any help.....
  59.  
  60.  -- 
  61. *******************************************************************
  62. Nandraj Arni
  63.  
  64. UniSQL, Inc.                           Voice: 512 343 7372 Ext. 107
  65. 9390 Research Blvd.                              Home: 512 794 9386
  66. Kaliedo II                             FAX: 512 343 7383
  67. Austin, TX 78759
  68.  
  69. Email: unisql!nandraj@cs.utexas.edu
  70. *******************************************************************
  71.