Subject: Re: bug#3208: 23.0.93; Memory full / crash when displaying lots of characters from a large font (like Arial Unicode or Code2000) which is not explicitly selected (on Win32)

From: Jason Rumney <[email-masked]>
Date: Mon, 22 Jun 2009 19:51:52 +0800

Kenichi Handa wrote:
> That will lead to slow display, but I don't understand why
> that leads to memory full problem.  How many fonts do people
> have on Windows roughly?  On GNU/Linux, I have about 700
> fontconfig fonts and 4500 X fonts.
>   

I have 2092 fonts available in Emacs (1692 available through the gdi 
backend, 420 through the uniscribe backend - I'm not sure where the 
other 20 went). The problem occurs even without the gdi backend enabled 
- so with 420 fonts.

> ??? JISX0208 surely contains U+2203 (THERE EXISTS).
>   
My mistake, so that is no problem.

> By the way, in short, which part of the current code is
> wrong?  Do you mean that there's a bug, or that the current
> strategy doesn't work for Windows?
>   

I haven't found what is actually going wrong here yet. But it looks like 
the problem is caused by has_char returning -1, then later encode_char 
returns FONT_INVALID_CODE. The latter does not happen with the gdi 
backend, because it just keeps the code as unicode, rejecting only 
characters that are beyond the first and last characters covered by the 
font.