GNU bug report logs -
#54562
28.0.91; Emoji sequence not composed
Previous Next
Full log
View this message in rfc822 format
> From: Andreas Schwab <schwab <at> linux-m68k.org>
> Cc: rpluim <at> gmail.com, luangruo <at> yahoo.com, larsi <at> gnus.org,
> 54562 <at> debbugs.gnu.org
> Date: Mon, 28 Mar 2022 18:20:31 +0200
>
> On Mär 28 2022, Eli Zaretskii wrote:
>
> >> How do I search for fonts containing a specific character?
> >
> > With fc or with Emacs?
>
> Whatever works.
Try this (only very lightly tested):
(defun fonts-supporting-char (test-char)
(let* ((inhibit-compacting-font-caches t)
(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 (string test-char)))
(if (vectorp glyphs)
(push (symbil- name (font-get font-obj :family))
fonts-for-char)))))
(clear-font-cache)
fonts-for-char))
Invoke like this:
(fonts-supporting-char #x308) => [... long list of font names ...]
This bug report was last modified 3 years and 133 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.