emacs-devel
[Top][All Lists]
Advanced

[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:21:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

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

To put it mildly.  So here's a new function that has one clear purpose:

diff --git a/src/font.c b/src/font.c
index 5e761abc5e..1bde062e87 100644
--- a/src/font.c
+++ b/src/font.c
@@ -4977,6 +4977,21 @@ DEFUN ("query-font", Fquery_font, Squery_font, 1, 1, 0,
                 : Qnil));
 }
 
+DEFUN ("font-has-glyph-p", Ffont_has_glyph_p, Sfont_has_glyph_p, 2, 2, 0,
+       doc:
+       /* Say whether FONT has a glyph for CHAR.  */)
+  (Lisp_Object font_object, Lisp_Object character)
+{
+  struct font *font = CHECK_FONT_GET_OBJECT (font_object);
+  CHECK_CHARACTER (character);
+
+  int c = XFIXNAT (character);
+  if (font->driver->encode_char (font, c) == FONT_INVALID_CODE)
+    return Qnil;
+  else
+    return Qt;
+}
+
 DEFUN ("font-get-glyphs", Ffont_get_glyphs, Sfont_get_glyphs, 3, 4, 0,
        doc:
        /* Return a vector of FONT-OBJECT's glyphs for the specified characters.
@@ -5548,6 +5563,7 @@ syms_of_font (void)
   defsubr (&Sclose_font);
   defsubr (&Squery_font);
   defsubr (&Sfont_get_glyphs);
+  defsubr (&Sfont_has_glyph_p);
   defsubr (&Sfont_match_p);
   defsubr (&Sfont_at);
 #if 0


-- 
(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]