Subject: Re: bug#54188: Crash when eval-ing font test elisp code

From: Eli Zaretskii <[email-masked]>
Date: Tue, 01 Mar 2022 21:37:37 +0200

> Date: Tue, 1 Mar 2022 20:50:48 +0200
> Cc: [email-masked]
> From: Vordoo <[email-masked]>
> 
> (gdb) fr 2
> #2  0x0000555555946ade in face_for_char (f=0x555556390770, face=0x555556528510, c=84, pos=744,
> object=XIL(0))
>     at /home/wsx/dev/emacs/emacs29/emacs/src/fontset.c:925
> 925      eassert (fontset_id_valid_p (face->fontset));
> (gdb) p face->fontset
> $1 = -1
> (gdb) fr 4
> #4  0x00005555555ead78 in get_next_display_element (it=0x7fffffff8800)
>     at /home/wsx/dev/emacs/emacs29/emacs/src/xdisp.c:8012
> 8012          it->face_id = FACE_FOR_CHAR (it->f, face, c, pos, it->string);
> (gdb) p it->face_id
> $2 = 34
> (gdb) p it->f->face_cache->used
> $3 = 35
> (gdb) 

Hmm...

Does evaluating the following (with M-:) crash on your system?

  (let ((str "The quick brown fox jumps over the lazy dog ´`''\"\"1lI|¦!Ø0Oo{[()]}.,:; "))
        (insert (propertize str
	        'font-lock-face '(:family "charter")) "\n")
        (insert (propertize str
                'font-lock-face '(:family "charter" :slant italic))))

It doesn't crash here, and so I wonder what happens on your system
that causes the face's fontset ID to become -1.  If you can figure
that out, maybe it will help; or maybe someone else will be able to
reproduce and investigate.

(I tried to do this with Caladings CLM font, but all the fonts I find
of that family are AFM or PFA/PFB fonts, and I cannot use them.)