From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Entering emojis Date: Sat, 30 Oct 2021 09:08:45 +0300 Message-ID: <83o877oxhu.fsf@gnu.org> References: <87cznths5j.fsf@gnus.org> <87h7d15mvi.fsf@gnus.org> <831r45tgu3.fsf@gnu.org> <87cznp5k6p.fsf@gnus.org> <83tuh1rvjt.fsf@gnu.org> <87czno3jmp.fsf@gnus.org> <83bl38s7t5.fsf@gnu.org> <871r440zj1.fsf@gnus.org> <83mtmsq7q1.fsf@gnu.org> <87r1c4x86a.fsf@gnus.org> <83ilxgq6k3.fsf@gnu.org> <87ilxfyl6w.fsf@gnus.org> <87a6irykbn.fsf@gnus.org> <83a6irrfam.fsf@gnu.org> <875ytfx014.fsf@gnus.org> <83v91fpuwy.fsf@gnu.org> <87fssjvgfj.fsf@gnus.org> <83r1c3pqa5.fsf@gnu.org> <87h7cztvdg.fsf@gnus.org> <87cznntuq6.fsf@gnus.org> <878rybtu6h.fsf@gnus.org> <874k8zttlz.fsf@gnus.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16606"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stefankangas@gmail.com, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 30 08:09:49 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mghYq-000484-Ta for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Oct 2021 08:09:49 +0200 Original-Received: from localhost ([::1]:46252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mghYo-0004JC-VP for ged-emacs-devel@m.gmane-mx.org; Sat, 30 Oct 2021 02:09:46 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49512) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mghY5-0003cz-6p for emacs-devel@gnu.org; Sat, 30 Oct 2021 02:09:01 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:42678) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mghY4-0004g7-R2; Sat, 30 Oct 2021 02:09:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=5xWmLXqpOP1atmprBlMYMwqKNyBZnGv6IIfwhZFhntA=; b=Xk0xKwy032jW UgOQCLRA/fN8b95TG1J+W8NXzY0rRdqAFgQua+zYIv45kA89dVjhFHY1Pj0nsXdEOwoNARPGl037e paBiW5+BTZMszdBweQi23HT4UAWhormnmEdIYqcRnffFM0dcv8RTil02EIm7280ZPU/SKXUuyJYLK c8FKyDYDTGVZ6TKXKFnCObfDFntZL2MHBH4ki/3/jeTyeFOXOG2EEHr2GmS3EENCofk0jYcnSnU0V 69RjgiHc2/qVnjdRvwDFeP8sldM+nVBhg4MjsFdmGX+VVTgRaDRtyDy6LxEOw9P0a5G20yyzR8B01 xMYmV081mbTJhk5uZQy6GQ==; Original-Received: from [87.69.77.57] (port=4100 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mghY3-0003eO-79; Sat, 30 Oct 2021 02:09:00 -0400 In-Reply-To: <874k8zttlz.fsf@gnus.org> (message from Lars Ingebrigtsen on Fri, 29 Oct 2021 23:21:28 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:278257 Archived-At: > From: Lars Ingebrigtsen > Cc: stefankangas@gmail.com, emacs-devel@gnu.org > Date: Fri, 29 Oct 2021 23:21:28 +0200 > > Lars Ingebrigtsen 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, Please call this font-has-char, since that's what it tests. > + doc: > + /* Say whether FONT has a glyph for CHAR. */) Not FONT, FONT-OBJECT. They are different beasts. > + (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; > +} Some font backends have a has_char method, which should be used if available in preference to encode_char. So I think a better implementation for this is to call font_has_char (in which case FONT-OBJECT could also be a font-entity, something that could be useful in some cases).