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: scratch/emoji vs emacs that maybe =?utf-8?Q?can=CA=BCt?= display emojis Date: Sun, 07 Nov 2021 18:30:24 +0200 Message-ID: <837ddk7wtb.fsf@gnu.org> References: <87y263ko4i.fsf@gmail.com> <87cznek745.fsf@gnus.org> <87bl2yk6qz.fsf@gmail.com> <87wnlkeysw.fsf@gnus.org> <87sfw8eyi0.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37661"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rpluim@gmail.com, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 07 17:31:37 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 1mjl4w-0009VQ-Tb for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Nov 2021 17:31:35 +0100 Original-Received: from localhost ([::1]:37244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mjl4v-0007Hy-II for ged-emacs-devel@m.gmane-mx.org; Sun, 07 Nov 2021 11:31:33 -0500 Original-Received: from [2001:470:142:3::10] (port=41638 helo=eggs.gnu.org) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjl41-0006RP-Mc for emacs-devel@gnu.org; Sun, 07 Nov 2021 11:30:37 -0500 Original-Received: from [2001:470:142:3::e] (port=49176 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjl41-0003RB-5D; Sun, 07 Nov 2021 11:30:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=14DpdAmQHA+jGJEy8tzA1y/9cYDFat/gmUXOt7hEa8o=; b=buyTM7+Iw2iD02TRKWX7 EbxrAx2YuoWUvznDmZXRDBb0D4HvH+RVKhn9ozI8JQsjoW2/F+ife5tKG75SLe+tfDx9M6O64+eKl jy+RPwr0CwfUT7i0xFoygxDjPPHIsvKlIbLhj2aNoiAv3XoxVM/y1oG79Xbd5VNoRdvpmcSwYAiYL nQ0zoHHSikxG6E/GTv/j6tRxmSXCD9uXMplEp+6Q6l/Bm4koekRUJcqb6SjO6pVDIW7OFQH++xkW2 E6goJ77fgS7CVcdG1fPzoCLqkPYGP9ECDRRLyAs12e1d1BukoCgfayXGTUi9U+lK/CnW6OX2bxE/M Yr2nOZeu0hJHkA==; Original-Received: from [87.69.77.57] (port=3711 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 1mjl40-0005wx-DG; Sun, 07 Nov 2021 11:30:37 -0500 In-Reply-To: <87sfw8eyi0.fsf@gnus.org> (message from Lars Ingebrigtsen on Sun, 07 Nov 2021 17:12:07 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:278966 Archived-At: > From: Lars Ingebrigtsen > Date: Sun, 07 Nov 2021 17:12:07 +0100 > Cc: emacs-devel@gnu.org > > Lars Ingebrigtsen writes: > > > 1) The string widths seem to be off (1 instead of 2), as Robert said > > earlier. So: > > Not for all of them. Normal single-char glyphs are correct: > > (string-width "😀") > => 2 > > But grapheme clusters are wrong: > > (string-width "☺️") > => 1 > > Presumably because it doesn't know that it's a cluster? No, because Emacs has no way of knowing how wide is the cluster produced by the terminal. string-width with single characters accesses our own data (in char-width-table), so we are okay. But for compositions on TTY frames we simply assume the result takes one column, because what else can we do? This problem has no solution, especially since different terminals produce results of different sizes. We could perhaps introduce some heuristics based on the first character of the composition, for example that the result of composing CH cannot be narrower than CH itself. But that will only work up to a point. E.g., AFAIR some Emoji has the width of 1. And then there are terminal emulators that do some preposterous stuff, assuming that their tail can wag the dog. See PROBLEMS and search for "kitty", for some fun.