emacs-devel
[Top][All Lists]
Advanced

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

Re: Entering emojis


From: Eli Zaretskii
Subject: Re: Entering emojis
Date: Fri, 29 Oct 2021 22:46:58 +0300

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: stefankangas@gmail.com,  emacs-devel@gnu.org
> Date: Fri, 29 Oct 2021 20:23:12 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Please repeat this after "M-x load-file Ret mule.el RET", so that we
> > see which parts of char-displayable-p take the lion's share of the
> > time.  Sorry I didn't think about this earlier.
> 
> Doesn't seem to be significantly more detailed...  The time spent is in
> internal-char-font (i.e., in C).

OK, that's what I thought it will say.

So how about the following  alternative strategy:

 . First, call (internal-char-font nil #x1f300).  This will return a
   cons cell whose car is a font object for the font that supports
   that codepoint.  If it returns nil, the system doesn't have a font
   for Emoji.

 . Then, for each character you want to test for being displayable,
   do this:

      (font-get-glyphs FONT-OBJECT 0 1 '[CODEPOINT])

   where FONT-OBJECT is the car of the value returned by
   internal-char-font, and CODEPOINT is the character you want to test
   for being displayable, for example #x1f600.  If this returns nil,
   that character is not supported by that font.

This should be faster, since it only checks a single font, and the
expensive call is outside the loop.



reply via email to

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