Path: utzoo!attcan!uunet!cs.utexas.edu!sun-barr!decwrl!ucbvax!LASALLE.CS.COLUMBIA.EDU!shamash From: shamash@LASALLE.CS.COLUMBIA.EDU (Ari Shamash) Newsgroups: comp.windows.x Subject: variable width fonts.. Message-ID: <8906301653.AA03679@lasalle.cs.columbia.edu> Date: 30 Jun 89 16:53:30 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 51 Is there a way of determining whether a font has variable or fixed width? The only way I could think of is by comparing the maximum and minimum widths provided by the XFontStruc for the particular font. Is there a better way? Thanks in advance, Ari shamash@cs.columbia.edu shamash@gollum.cs.columbia.edu ...!rutgers!columbia!gollum!shamash ------------------------ Here is my program.. #include #include #include main (argc, argv) int argc; char **argv; { Display *display; XFontStruct *font; if (argc < 2) { fprintf(stderr, "usage: %s fontname.\n", argv[0]); exit(1); } if ((display = XOpenDisplay (NULL)) == NULL) { fprintf(stderr, "Can't open X display connection.\n"); exit(1); } if ((font = XLoadQueryFont(display, argv[1])) == (XFontStruct *) NULL) { fprintf(stderr, "The font %s is not available.\n", argv[1]); XCloseDisplay(display); exit(1); } if (font ->min_bounds.width == font ->max_bounds.width) printf("%s is fixed width.\n", argv[1]); else printf("%s is not fixed width.\n", argv[1]); XFreeFont(display,font); XCloseDisplay(display); exit(0); }