[Top][All Lists]

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

Re: Entering emojis

From: Lars Ingebrigtsen
Subject: Re: Entering emojis
Date: Fri, 29 Oct 2021 23:09:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> And indeed, for that set of code points, internal-char-font and
> font-get-glyphs take almost exactly the same time, which is very odd.

Or perhaps not!  That function does quite a lot of work both when it
gets a match and not (allocating vectors and stuff).

As a test, I made it return t/nil if fed a character:

diff --git a/src/font.c b/src/font.c
index 5e761abc5e..3b0309088b 100644
--- a/src/font.c
+++ b/src/font.c
@@ -5067,6 +5067,14 @@ DEFUN ("font-get-glyphs", Ffont_get_glyphs, 
Sfont_get_glyphs, 3, 4, 0,
       chars = aref_addr (object, ifrom);
+  else if (INTEGERP (object))
+    {
+      int c = XFIXNAT (object);
+      if (font->driver->encode_char (font, c) == FONT_INVALID_CODE)
+       return Qnil;
+      else
+       return Qt;
+    }
     wrong_type_argument (Qarrayp, object);
And that made it really, really fast -- like 100x faster in the test
case.  :-)

Should I fix this up and document it?  It's perhaps not an ideal

(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

reply via email to

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