GNU bug report logs - #57976
29.0.50; Complex emoji have extra spacing

Previous Next

Package: emacs;

Reported by: Protesilaos Stavrou <info <at> protesilaos.com>

Date: Wed, 21 Sep 2022 10:18:02 UTC

Severity: normal

Merged with 59606

Found in version 29.0.50

Done: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57976 in the body.
You can then email your comments to 57976 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Wed, 21 Sep 2022 10:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Protesilaos Stavrou <info <at> protesilaos.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 21 Sep 2022 10:18:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Protesilaos Stavrou <info <at> protesilaos.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Complex emoji have extra spacing
Date: Wed, 21 Sep 2022 13:17:40 +0300
[Message part 1 (text/plain, inline)]
Dear maintainers,

With a recent build of Emacs and harfbuzz version 5.2.0 all the complex
emoji have extra spacing after them.  This space is present everywhere
the affected emoji is displayed.  One example is the interface of the
command 'emoji-search'.

Steps to reproduce the attached screenshot on 'emacs -Q':

- Type 'C-x 8 e s'
- Type "face" and then TAB twice to bring up the Completions' buffer.

All the best,
Protesilaos (or simply "Prot")

* * *

In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
 3.24.34, cairo version 1.17.6) of 2022-09-21 built on kronos
Repository revision: 1231a601ebe1fd9fe454c504dbeb9267440242e7
Repository branch: makepkg
System Description: Arch Linux

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --without-libotf --without-m17n-flt --without-gconf
 --with-native-compilation --with-pgtk --with-sound=no --without-gpm
 --without-compress-install
 '--program-transform-name=s/\([ec]tags\)/\1.emacs/'
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection'
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK
PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP XIM GTK3
ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

-- 
Protesilaos Stavrou
https://protesilaos.com
[Screenshot from 2022-09-21 13-08-26.png (image/png, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Wed, 21 Sep 2022 10:31:02 GMT) Full text and rfc822 format available.

Message #8 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Protesilaos Stavrou <info <at> protesilaos.com>
Cc: 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Wed, 21 Sep 2022 12:30:44 +0200
[Message part 1 (text/plain, inline)]
Protesilaos Stavrou <info <at> protesilaos.com> writes:

> With a recent build of Emacs and harfbuzz version 5.2.0 all the complex
> emoji have extra spacing after them.  This space is present everywhere
> the affected emoji is displayed.  One example is the interface of the
> command 'emoji-search'.
>
> Steps to reproduce the attached screenshot on 'emacs -Q':
>
> - Type 'C-x 8 e s'
> - Type "face" and then TAB twice to bring up the Completions' buffer.

[...]

> In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.34, cairo version 1.17.6) of 2022-09-21 built on kronos
> Repository revision: 1231a601ebe1fd9fe454c504dbeb9267440242e7
> Repository branch: makepkg
> System Description: Arch Linux

I don't see this with:

In GNU Emacs 29.0.50 (build 61, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2022-09-16 built on joga
Repository revision: 7d39453fd64e355526291b0ca5672e838de5fb58
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
System Description: Ubuntu 22.04.1 LTS

This is with an earlier version of harfbuzz, though.

libharfbuzz-dev/jammy-updates,jammy-security,now 2.7.4-1ubuntu3.1 

[Message part 2 (image/png, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Wed, 21 Sep 2022 10:49:01 GMT) Full text and rfc822 format available.

Message #11 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: Protesilaos Stavrou <info <at> protesilaos.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Wed, 21 Sep 2022 13:48:03 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Wed, 21 Sep 2022 12:30:44 +0200
>
> Protesilaos Stavrou <info <at> protesilaos.com> writes:
>
>> With a recent build of Emacs and harfbuzz version 5.2.0 all the complex
>> emoji have extra spacing after them.  This space is present everywhere
>> the affected emoji is displayed.  One example is the interface of the
>> command 'emoji-search'.
>>
>> Steps to reproduce the attached screenshot on 'emacs -Q':
>>
>> - Type 'C-x 8 e s'
>> - Type "face" and then TAB twice to bring up the Completions' buffer.
>
> [...]
>
>> In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version
>>  3.24.34, cairo version 1.17.6) of 2022-09-21 built on kronos
>> Repository revision: 1231a601ebe1fd9fe454c504dbeb9267440242e7
>> Repository branch: makepkg
>> System Description: Arch Linux
>
> I don't see this with:
>
> In GNU Emacs 29.0.50 (build 61, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.33, cairo version 1.16.0) of 2022-09-16 built on joga
> Repository revision: 7d39453fd64e355526291b0ca5672e838de5fb58
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101003
> System Description: Ubuntu 22.04.1 LTS
>
> This is with an earlier version of harfbuzz, though.
>
> libharfbuzz-dev/jammy-updates,jammy-security,now 2.7.4-1ubuntu3.1 

I just downgraded to harfbuzz 5.1.0 and restarted Emacs.  The spacing is
fine now.  I suppose this means we should close this bug and report it
to the harfbuzz maintainers.  Though I thought I would bring it to your
attention.

-- 
Protesilaos Stavrou
https://protesilaos.com




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Wed, 21 Sep 2022 10:54:02 GMT) Full text and rfc822 format available.

Message #14 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Protesilaos Stavrou <info <at> protesilaos.com>
Cc: 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Wed, 21 Sep 2022 12:53:14 +0200
Protesilaos Stavrou <info <at> protesilaos.com> writes:

> I just downgraded to harfbuzz 5.1.0 and restarted Emacs.  The spacing is
> fine now.  I suppose this means we should close this bug and report it
> to the harfbuzz maintainers.  Though I thought I would bring it to your
> attention.

Yes, if you could bring it to their attention, it would be nice, but I'd
rather keep this bug report open until there's an answer -- perhaps
there's something we have to adjust in the code on our side with newer
harfbuzz versions?

If this is not an actual bug in harfbuzz, perhaps the harfbuzz
developers have some advice here...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Wed, 21 Sep 2022 13:21:02 GMT) Full text and rfc822 format available.

Message #17 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: Protesilaos Stavrou <info <at> protesilaos.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Wed, 21 Sep 2022 16:20:15 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Wed, 21 Sep 2022 12:53:14 +0200
>
> Protesilaos Stavrou <info <at> protesilaos.com> writes:
>
>> I just downgraded to harfbuzz 5.1.0 and restarted Emacs.  The spacing is
>> fine now.  I suppose this means we should close this bug and report it
>> to the harfbuzz maintainers.  Though I thought I would bring it to your
>> attention.
>
> Yes, if you could bring it to their attention, it would be nice, but I'd
> rather keep this bug report open until there's an answer -- perhaps
> there's something we have to adjust in the code on our side with newer
> harfbuzz versions?
>
> If this is not an actual bug in harfbuzz, perhaps the harfbuzz
> developers have some advice here...

I have no reproducible recipe with harfbuzz 5.2.0 beside Emacs.  I wrote
the M-x emoji-list buffer to a file and visited it with a generic text
editor: the display looks fine.

I will try some other programs to see if they are affected.

-- 
Protesilaos Stavrou
https://protesilaos.com




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Wed, 21 Sep 2022 13:36:02 GMT) Full text and rfc822 format available.

Message #20 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Protesilaos Stavrou <info <at> protesilaos.com>
Cc: 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Wed, 21 Sep 2022 15:35:02 +0200
Protesilaos Stavrou <info <at> protesilaos.com> writes:

> I have no reproducible recipe with harfbuzz 5.2.0 beside Emacs.  I wrote
> the M-x emoji-list buffer to a file and visited it with a generic text
> editor: the display looks fine.

If you take one of the emojis that displayed correctly and one that was
wrong and then say

(string-pixel-width "😶‍🌫️")

on both -- what does that return?  From the display, it kinda looked
like Emacs thought that some of the glyphs were really wide.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Wed, 21 Sep 2022 13:47:02 GMT) Full text and rfc822 format available.

Message #23 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: Protesilaos Stavrou <info <at> protesilaos.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Wed, 21 Sep 2022 16:46:32 +0300
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Wed, 21 Sep 2022 15:35:02 +0200
>
> Protesilaos Stavrou <info <at> protesilaos.com> writes:
>
>> I have no reproducible recipe with harfbuzz 5.2.0 beside Emacs.  I wrote
>> the M-x emoji-list buffer to a file and visited it with a generic text
>> editor: the display looks fine.
>
> If you take one of the emojis that displayed correctly and one that was
> wrong and then say
>
> (string-pixel-width "😶‍🌫️")
>
> on both -- what does that return?  From the display, it kinda looked
> like Emacs thought that some of the glyphs were really wide.

I get these:

    (string-pixel-width "😶‍🌫️")
    ;; => 136

    (string-pixel-width "🤣")
    ;; => 16

-- 
Protesilaos Stavrou
https://protesilaos.com

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Wed, 21 Sep 2022 14:04:01 GMT) Full text and rfc822 format available.

Message #26 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Protesilaos Stavrou <info <at> protesilaos.com>
Cc: 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Wed, 21 Sep 2022 16:03:02 +0200
Protesilaos Stavrou <info <at> protesilaos.com> writes:

> I get these:
>
>     (string-pixel-width "😶‍🌫️")
>     ;; => 136
>
>     (string-pixel-width "🤣")
>     ;; => 16

Wow.  So Emacs gets the dimensions of 😶‍🌫️ really, really wrong with that
harfbuzz version.  😶‍🌫️ is composed of

FACE WITHOUT MOUTH
ZERO WIDTH JOINER
FOG
VARIATION SELECTOR-16

so even if it counted all four of those separately, we'd just get to
(* 16 4) = 64, not 136...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Thu, 22 Sep 2022 02:01:02 GMT) Full text and rfc822 format available.

Message #29 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Protesilaos Stavrou <info <at> protesilaos.com>
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Thu, 22 Sep 2022 11:00:15 +0900
On Wed, 21 Sep 2022 22:46:32 +0900,
Protesilaos Stavrou wrote:
> 
> > From: Lars Ingebrigtsen <larsi <at> gnus.org>
> > Date: Wed, 21 Sep 2022 15:35:02 +0200
> >
> > Protesilaos Stavrou <info <at> protesilaos.com> writes:
> >
> >> I have no reproducible recipe with harfbuzz 5.2.0 beside Emacs.  I wrote
> >> the M-x emoji-list buffer to a file and visited it with a generic text
> >> editor: the display looks fine.
> >
> > If you take one of the emojis that displayed correctly and one that was
> > wrong and then say
> >
> > (string-pixel-width "😶‍🌫️")
> >
> > on both -- what does that return?  From the display, it kinda looked
> > like Emacs thought that some of the glyphs were really wide.
> 
> I get these:
> 
>     (string-pixel-width "😶‍🌫️")
>     ;; => 136
> 
>     (string-pixel-width "🤣")
>     ;; => 16

Hmm, the fix for Bug#57066 needs to be undone for HarfBuzz 5.2.0.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp

diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index e089f9dea8..a02ff99870 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -679,8 +679,12 @@ ftcrhbfont_begin_hb_font (struct font *font, double *position_unit)
   hb_font_t *hb_font = fthbfont_begin_hb_font (font, position_unit);
   /* HarfBuzz 5 correctly scales bitmap-only fonts without position
      unit adjustment.
-     (https://github.com/harfbuzz/harfbuzz/issues/489) */
-  if (!hb_version_atleast (5, 0, 0)
+     (https://github.com/harfbuzz/harfbuzz/issues/489)
+
+     Update: HarfBuzz 5.2.0 no longer does this for an hb_font_t font
+     object created from a given FT_Face.
+     (https://github.com/harfbuzz/harfbuzz/issues/3788) */
+  if ((hb_version_atleast (5, 2, 0) || !hb_version_atleast (5, 0, 0))
       && ftcrfont_info->bitmap_position_unit)
     *position_unit = ftcrfont_info->bitmap_position_unit;
 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57976; Package emacs. (Thu, 22 Sep 2022 07:09:01 GMT) Full text and rfc822 format available.

Message #32 received at 57976 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: info <at> protesilaos.com, larsi <at> gnus.org, 57976 <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Thu, 22 Sep 2022 10:08:23 +0300
> Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 57976 <at> debbugs.gnu.org
> Date: Thu, 22 Sep 2022 11:00:15 +0900
> From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
> 
> > I get these:
> > 
> >     (string-pixel-width "😶‍🌫️")
> >     ;; => 136
> > 
> >     (string-pixel-width "🤣")
> >     ;; => 16
> 
> Hmm, the fix for Bug#57066 needs to be undone for HarfBuzz 5.2.0.

Thanks, please install this on the emacs-28 branch.




Reply sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
You have taken responsibility. (Fri, 23 Sep 2022 05:22:01 GMT) Full text and rfc822 format available.

Notification sent to Protesilaos Stavrou <info <at> protesilaos.com>:
bug acknowledged by developer. (Fri, 23 Sep 2022 05:22:01 GMT) Full text and rfc822 format available.

Message #37 received at 57976-done <at> debbugs.gnu.org (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: info <at> protesilaos.com, larsi <at> gnus.org, 57976-done <at> debbugs.gnu.org
Subject: Re: bug#57976: 29.0.50; Complex emoji have extra spacing
Date: Fri, 23 Sep 2022 14:21:46 +0900
On Thu, 22 Sep 2022 16:08:23 +0900,
Eli Zaretskii wrote:
> 
> > Cc: Lars Ingebrigtsen <larsi <at> gnus.org>, 57976 <at> debbugs.gnu.org
> > Date: Thu, 22 Sep 2022 11:00:15 +0900
> > From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
> > 
> > > I get these:
> > > 
> > >     (string-pixel-width "😶‍🌫️")
> > >     ;; => 136
> > > 
> > >     (string-pixel-width "🤣")
> > >     ;; => 16
> > 
> > Hmm, the fix for Bug#57066 needs to be undone for HarfBuzz 5.2.0.
> 
> Thanks, please install this on the emacs-28 branch.

Done.  Closing.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 21 Oct 2022 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Kévin Le Gouguec <kevin.legouguec <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 30 Nov 2022 21:01:02 GMT) Full text and rfc822 format available.

Merged 57976 59606. Request was from Kévin Le Gouguec <kevin.legouguec <at> gmail.com> to control <at> debbugs.gnu.org. (Wed, 30 Nov 2022 21:01:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Dec 2022 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 111 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.