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: Fri, 29 Oct 2021 22:46:58 +0300 Message-ID: <83r1c3pqa5.fsf@gnu.org> References: <87cznths5j.fsf@gnus.org> <875yth7bjr.fsf@gnus.org> <871r4576ey.fsf@gnus.org> <87wnlx5rd4.fsf@gnus.org> <837ddxtimp.fsf@gnu.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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7476"; 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 Fri Oct 29 22:12:35 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 1mgYEs-0001lH-DQ for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Oct 2021 22:12:34 +0200 Original-Received: from localhost ([::1]:55454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgYEr-0005Bs-Aa for ged-emacs-devel@m.gmane-mx.org; Fri, 29 Oct 2021 16:12:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgXqO-0005Wi-Hs for emacs-devel@gnu.org; Fri, 29 Oct 2021 15:47:16 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:52036) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgXqO-0000cT-63; Fri, 29 Oct 2021 15:47:16 -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=OXmzPryiDiPdz1VVwRWuCsnQfgFofmPHTpKwi2AY+VY=; b=I+s1g/MFx7kE /EOAWLbWk8UFQFzPCLpB69pcPMQ96lHT7Q+zIyliH8Yl/6jkt4aVXFYyt8eaRtubaujfzYXDanKNr hU5evcaTbwa/2yAqpuKCo3XqnsvKKoZl0A2iof5teXZGl0sjuR1kJzhe2X6ItdoBuedGcUtwpe6BL oNu6r7dztxufD4ErICYaCn+TejavUTAXnl3zYUt3S/dgd6hIIxeOfHNo3iq+H5AiGSstxHU4CQ2xK I1pRn2PXbJpMBDig3EXEvrXvjQfPTXzUorDUamct2MNhdbOwqhaF2/UVrjqvgYwF8B0CvJsy35hSN pCCZhSBbYeG1l8ssO2NpEw==; Original-Received: from [87.69.77.57] (port=2011 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 1mgXqL-0007wP-G5; Fri, 29 Oct 2021 15:47:15 -0400 In-Reply-To: <87fssjvgfj.fsf@gnus.org> (message from Lars Ingebrigtsen on Fri, 29 Oct 2021 20:23:12 +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:278241 Archived-At: > From: Lars Ingebrigtsen > Cc: stefankangas@gmail.com, emacs-devel@gnu.org > Date: Fri, 29 Oct 2021 20:23:12 +0200 > > Eli Zaretskii 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.