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

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

bug#3659: FW: 23.0.95; crash on set-frame-font


From: Kenichi Handa
Subject: bug#3659: FW: 23.0.95; crash on set-frame-font
Date: Mon, 29 Jun 2009 11:24:03 +0900

In article <nkskhm9yyp.fsf@fencepost.gnu.org>, Glenn Morris <rgm@gnu.org> 
writes:

> Kenichi Handa wrote:
> > In a debugger, please check the values of filename (LispString),
> > index (LispInt), and xftfont (XftFont *) just before calling
> > XftLockFace at xftfont.c:290.

> A breakpoint in this area is triggered 4 times before the Emacs frame
> appears, then once more after the frame appears. It crashes on the 5th
> time.

> The 5 values of filename are:
> /usr/openwin/lib/X11/fonts/75dpi/courR14.pcf.Z
> /usr/openwin/lib/X11/fonts/75dpi/courR14.pcf.Z
> /usr/openwin/lib/X11/fonts/75dpi/courO14.pcf.Z
> /usr/openwin/lib/X11/fonts/75dpi/courR14.pcf.Z
> /usr/openwin/lib/X11/fonts/100dpi/courB10.pcf.Z

> "index" is always 0.

> "xftfont" is always 0 (perhaps I am printing it wrong? I use "pp".)

You should use the normal p(rint) command for xftfont
because it is not a Lisp object.  But, if "pp xftfont" shows
0, xftfont is actually NULL.

> > By the way, are there any fonts with that you can startup
> > Emacs with --xrm 'Emacs*FontBackend: xft'?

> I didn't check them all, but these work:

> -*-FreeMono-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1
> -monotype-Times New-Roman-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1

> These are both TrueType fonts. I did not find any of the fonts in the
> 75dpi directory that worked (but it was not an exhaustive search).

Hmmm, it seems that there's something wrong in you Xft (or
underlying fontconfig/freetype)

Please compile the attached program and run it (as below).
What is shown?

% gcc `pkg-config --cflags xft` `pkg-config --libs xft` -o xfttest xfttest.c 
% ./xfttest /usr/openwin/lib/X11/fonts/75dpi/courR14.pcf.Z

---
Kenichi Handa
handa@m17n.org

--- xfttest.c ---
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/Xft/Xft.h>

int
main (int argc, char **argv)
{
  Display *display;
  FcPattern *pat, *match;
  FcObjectSet *objset;
  FcFontSet *fontset;
  FcResult result;
  XftFont *font;
      
  display = XOpenDisplay (NULL);
  if (! display)
    {
      fprintf (stderr, "Can't open a display\n");
      exit (1);
    }
  if (argc < 2)
    {
      fprintf (stderr, "Usage: xfttest FONT-FILE-NAME\n");
      exit (1);
    }

  printf ("Listing a font by file name and index ... ");
  pat = FcPatternBuild (0, FC_FILE, FcTypeString,
                        (FcChar8 *) argv[1],
                        FC_INDEX, FcTypeInteger, 0, NULL);
  objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT,
                             FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, FC_SCALABLE,
                             FC_STYLE, FC_FILE, FC_INDEX, NULL);
  fontset = FcFontList (NULL, pat, objset);
  if (fontset && fontset->nfont > 0)
    {
      int i;

      printf ("found these fonts:\n");
      for (i = 0; i < fontset->nfont; i++)
        {
          FcChar8 *file;

          printf ("  %02d:", i + 1);
          if (FcPatternGetString (fontset->fonts[i], FC_FILE, 0, &file)
              == FcResultMatch)
            printf ("%s\n", (char *) file);
          else
            printf ("no filename\n");
        }
      printf ("Matching the first one ... ");
      match = XftFontMatch (display, 0, fontset->fonts[0], &result);
      if (match)
        {
          FcChar8 *file;
          FcPatternGetString (match, FC_FILE, 0, &file);
          printf (" matched\n  %s opening ... ", file);
          font = XftFontOpenPattern (display, match);
          if (font)
            {
              printf ("ok\n");
              XftFontClose (display, font);
            }
          else
            {
              printf ("no\n");
            }
        }
      else
        {
          printf (" not matched\n");
        }
    }
  else
    {
      printf (" none\n");
    }

  exit (0);
}





reply via email to

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