[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: characters in X-application replaced with boxes :(

Drew Parsons <dparsons@emerall.com> writes:

> Where an XFontStruct structure is found, is there any way to find the full
> name of the corresponding font?  It's not obvious from the structure of the
> struct.  If I could know what font it thinks it's using, that'd at least be
> a start.

I've had good luck with this toy program, maybe you'll find it helpful

#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <stdio.h>

main (int argc, char *argv[])
  XFontStruct *fnt;
  Display *dpy;
  unsigned long prop;

  if ( !(dpy = XOpenDisplay(NULL)) )
      fprintf(stderr, "Cannot open display.\n");
      return 1;

  if ( !(fnt = XLoadQueryFont(dpy, "6x13")) )
      fprintf(stderr, "Cannot load 6x13 font.\n");
      return 2;

  if ( XGetFontProperty(fnt, XA_FONT, &prop) )
    printf("font name is: %s\n", XGetAtomName(dpy, (Atom)prop));

  return 0;


SBB: Store in Bit Bucket

Reply to: