bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#505: 23.0.60; Font for fixed-pitch not resolved


From: Chong Yidong
Subject: bug#505: 23.0.60; Font for fixed-pitch not resolved
Date: Wed, 15 Oct 2008 21:04:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Interesting.  Okay, let's try something else (thanks for bearing with
me).

Could you save the following program in a file called, say, foo.c, then
compile it, run it, and show me the output (if any)?

cyd: ~ $ gcc foo.c -lX11 -o foo
cyd: ~ $ ./foo

Here's the program:

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


int main ()
{
  int i, limit, num_fonts;
  char **names;
  Display *display = XOpenDisplay (NULL);
  char *pattern = "-unknown-Monospace-*-*-*-*-*-*-*-*-*-*-iso8859-1";

  for (limit = 512; ; limit *= 2)
    {
      names = XListFonts (display, pattern, limit, &num_fonts);
      if (num_fonts < limit)
        break;
      XFreeFontNames (names);
    }

  for (i = 0; i < num_fonts; i++)
    {
      XFontStruct *font;
      unsigned long value;

      printf ("%s\n", names[i]);
      font = XLoadQueryFont (display, names[i]);
      if (! font)
        continue;
      if (XGetFontProperty (font, XA_FONT, &value))
        {
          char *name = (char *) XGetAtomName (display, (Atom) value);
          int len = strlen (name);
          if (len > 0)
            printf("  %s\n", name);
        }
    }

  return 0;
}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]