Subject: Re: bug#54562: 28.0.91; Emoji sequence not composed

From: Eli Zaretskii <[email-masked]>
Date: Mon, 28 Mar 2022 21:15:29 +0300

> From: Andreas Schwab <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked],
>   [email-masked]
> Date: Mon, 28 Mar 2022 19:39:43 +0200
> 
> On Mär 28 2022, Eli Zaretskii wrote:
> 
> > Try this (only very lightly tested):
> >
> >   (defun fonts-supporting-char (test-char)
> 
> Doesn't work.  It claims support for a lot of fonts that don't contain
> that character.

Try this fixed version instead:

  (defun fonts-supporting-char (test-char)
    (let* ((inhibit-compacting-font-caches t)
	   (test-str (string test-char))
	   (frame (selected-frame))
	   (fnt-list
	    (delete-dups
	     (x-list-fonts "-*-*-medium-r-normal-*-*-*-*-*-*-iso10646-1"
			   'default frame)))
	   fspec fonts-for-char ffont font-obj glyphs)
      (dolist (fnt fnt-list)
	(setq fspec (ignore-errors (font-spec :name fnt)))
	(if fspec
	    (setq ffont (find-font fspec frame)))
	(when ffont
	  (setq font-obj (open-font ffont nil frame))
	  (when font-obj
	    (setq glyphs (font-get-glyphs font-obj 0 1 test-str))
	    (if (and (vectorp glyphs) (aref glyphs 0))
		(push (symbol-name (font-get font-obj :family))
		      fonts-for-char)))))
      (clear-font-cache)
      fonts-for-char))