bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54562: 28.0.91; Emoji sequence not composed


From: Eli Zaretskii
Subject: bug#54562: 28.0.91; Emoji sequence not composed
Date: Mon, 28 Mar 2022 20:10:22 +0300

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: rpluim@gmail.com,  luangruo@yahoo.com,  larsi@gnus.org,
>   54562@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 ...]






reply via email to

[Prev in Thread] Current Thread [Next in Thread]