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

From: oslsachem <[email-masked]>
Date: Fri, 27 May 2011 20:33:33 +0200

> So I think we found the culprit, the question is how to make this
> work.  But first let's make sure the call to GetTextMetricsW indeed
> fails.  Please change this code in w32font_open_internal:
>
>  len = GetOutlineTextMetricsW (dc, 0, NULL);
>  if (len)
>    {
>      metrics = (OUTLINETEXTMETRICW *) alloca (len);
>      if (GetOutlineTextMetricsW (dc, len, metrics))
>        bcopy (&metrics->otmTextMetrics, &w32_font->metrics,
>               sizeof (TEXTMETRICW));
>      else
>        metrics = NULL;
>    }
>
>  if (!metrics)
>    GetTextMetricsW (dc, &w32_font->metrics);
>
> to say this instead:
>
>  unsigned e;
>  ...
>  len = GetOutlineTextMetricsW (dc, 0, NULL);
>  if (len)
>    {
>      metrics = (OUTLINETEXTMETRICW *) alloca (len);
>      if (GetOutlineTextMetricsW (dc, len, metrics))
>        bcopy (&metrics->otmTextMetrics, &w32_font->metrics,
>               sizeof (TEXTMETRICW));
>      else
>        metrics = NULL;
>    }
>  else
>    e = GetLastError ();
>
>  if (!metrics)
>    {
>      if (!GetTextMetricsW (dc, &w32_font->metrics))
>        e = GetLastError ();
>    }
>
> Then compile, step through the code again, and tell what value gets
> assigned to e.

http://www.speedyshare.com/files/28673968/Emacs-23.3GDBprintE.txt

Greetings,
                Osl