/* font_list.c just to produce list of available fonts in text window */ /* run font_list > font_list.out */ /* compile gcc -o font_list font_list.c -lXm -lXt -lX11 */ #include #include main(int argc, char *argv[]) { Widget toplevel; XtAppContext app; extern char **XListFonts(); char **list; int i, j; toplevel = XtVaAppInitialize(&app, "Demos", NULL, 0, &argc, argv, NULL, NULL); list = XListFonts(XtDisplay(toplevel), "*", 32767, &j); for (i = 0; i < j; i++) { printf("%s \n",list[i]); } /* not needed */ /* XFreeFontNames(list); XtRealizeWidget(toplevel); XtAppMainLoop(app); */ } /* other options are to choose fonts via an application defaults file *XmText.Font : -*-*-*-*-*-*-*-120-75-75-M-* or in your program: Font font; font = XLoadFont(dpy, "-*-courier-medium-r-normal-*-14*"); XSetFont(dpy, gc, font); or, get fancy and look through font list, pick one, XLoadFont on the one you picked (by code in your program.) */