Subject: bug#8562: Emacs 23.1 and later don't work in windows 98

From: Eli Zaretskii <[email-masked]>
Date: Wed, 25 May 2011 19:44:31 +0300

> Date: Wed, 25 May 2011 12:53:29 +0200
> From: oslsachem <[email-masked]>
> Cc: [email-masked]
> 
> > If the value of f->line_height is indeed bogus, please put a
> > breakpoint in x_new_font, run Emacs again, and when the breakpoint
> > breaks, step through that function and see why it doesn't put a valid
> > value into this field.  This should happen on line 5280 of w32term.c:
> >
> >  FRAME_LINE_HEIGHT (f) = font->height;
> >
> > If this indeed assigns a bogus value, please show the contents of the
> > `font' structure ("print *font" at GDB prompt).
> 
> http://www.speedyshare.com/files/28635231/Emacs-23.3GDBfont.txt

> (gdb) p font->height
> $2 = 2087156864
> (gdb) p *font
> $3 = {
>   size = 1075838994, 
>   next = 0x37fc800, 
>   props = {50024618, 50024882, 52291426, 50024834, 50018570, 102720, 102528, 
>     102656, 52, 49805314, 440, 49805314, 50073638, 49805314, 52216865, 
>     52216881, 49805314, 50018522}, 
>   max_width = 2113995264, 
>   pixel_size = 13, 
>   height = 2087156864, 
>   space_width = 101581574, 
>   average_width = 101581574, 
>   min_width = 101581574, 
>   ascent = 2053600883, 
>   descent = 33555981, 
>   underline_thickness = 0, 
>   underline_position = -1, 
>   vertical_centering = 0, 
>   encoding_type = 0 '\000', 
>   baseline_offset = 0, 
>   relative_compose = 0, 
>   default_ascent = 2053600883, 
>   font_encoder = 0x0, 
>   driver = 0x151c220, 
>   encoding_charset = -1, 
>   repertory_charset = -1
> }

Looks like the font structure is garbled, at least most of its fields
are.

On Windows XP I see this instead:

  (gdb) p *font
  $1 = {
    size = 1075838994,
    next = 0x101ed800,
    props = {48349354, 48349618, 50593634, 48349570, 48343306, 102720, 102528,
      102656, 52, 48130050, 440, 48130050, 48395622, 48130050, 50523489,
      50523505, 48130050, 48343258},
    max_width = 9,
    pixel_size = 13,
    height = 16,
    space_width = 8,
    average_width = 8,
    min_width = 8,
    ascent = 12,
    descent = 4,
    underline_thickness = 1,
    underline_position = 3,
    vertical_centering = 0,
    encoding_type = 0 '\000',
    baseline_offset = 0,
    relative_compose = 0,
    default_ascent = 12,
    font_encoder = 0x0,
    driver = 0x153c300,
    encoding_charset = -1,
    repertory_charset = -1
  }

We are entering an area of Emacs where I don't know enough, so I hope
Jason will chime in RSN...

Anyway.  Could you please step through x_default_font_parameter, and
see which font it picks up here:

  font = !NILP (font_param) ? font_param
    : x_get_arg (dpyinfo, parms, Qfont, "font", "Font", RES_TYPE_STRING);

  if (!STRINGP (font))
    {
      int i;
      static char *names[]
        = { "Courier New-10",
            "-*-Courier-normal-r-*-*-13-*-*-*-c-*-iso8859-1",
            "-*-Fixedsys-normal-r-*-*-12-*-*-*-c-*-iso8859-1",
            "Fixedsys",
            NULL };

      for (i = 0; names[i]; i++)
        {
          font = font_open_by_name (f, names[i]);
          if (! NILP (font))
            break;
        }
      if (NILP (font))
        error ("No suitable font was found");

A word about displaying values of variables declared Lisp_Object.  You
need to start GDB from a directory where you have the .gdbinit file
that comes with the source tarball (you will find it in the src/
directory).  Then use the "pp" command instead of "p" or "print" to
display values of Lisp_Object variables.

After you determine which font is being picked up in the above loop,
please put a breakpoint in uniscribe_open and see if it and especially
w32font_open_internal that it calls succeed to open the font; if they
fail, please try to see why.

Finally, if you start Emacs with "emacs -Q -xrm Emacs.fontBackend:gdi",
does it also aborts in the same way, i.e. inside window_box_height?

Thanks.