From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tim Ruffing Newsgroups: gmane.emacs.bugs Subject: bug#73752: 29.4; Ligatures are randomly rendered with extra spaces Date: Wed, 30 Oct 2024 00:14:58 +0100 Message-ID: <91cb4d5a6c979bf096ca9fa26711395ab29b941b.camel@timruffing.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15894"; mail-complaints-to="usenet@ciao.gmane.io" To: 73752@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 30 02:20:21 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1t5xNk-0003yL-Ta for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 30 Oct 2024 02:20:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5xNU-00038P-TM; Tue, 29 Oct 2024 21:20:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5xNS-00038F-IC for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2024 21:20:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t5xNS-0007Yb-6l for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2024 21:20:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=v2fG9KWEXSb7lE8rqO+k/RDmCsxmN9nDHEud64CM9cA=; b=pDIZPH6eDd1/1iWxsDtTqVzVEgzaFKpkPLoNh+gM2jgK4qWiSvdOjlkxseWmm3ZDSr6fKTeVSWLe5EoGY5EOuS610FLiE+ZkvQetyuPIcZwB6nuOKUxcUhT75RkKJ29zRtI/Dxu91+azwJXwZBTfp+IEOl0R8lRXsiAHD5rcdXI2EHpjT3ATb4v/Tjec/YTDYqgjJA0S5AyiuWNzNUVMsuvNbMMWGVeoT4RqA40X1pvttB7Gxodr4TRHpOB0QZ0q4TYVXPdsLRwQEY4HgMDD7ahE0hVNgQwqhn3Qm10TTFQPszJquK7VKgbL2v12DWt/9Wp9KDxFqkFn/lAmCg0tpA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t5xNR-0002ft-Nx for bug-gnu-emacs@gnu.org; Tue, 29 Oct 2024 21:20:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Tim Ruffing Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2024 01:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73752 X-GNU-PR-Package: emacs Original-Received: via spool by 73752-submit@debbugs.gnu.org id=B73752.173025115510258 (code B ref 73752); Wed, 30 Oct 2024 01:20:01 +0000 Original-Received: (at 73752) by debbugs.gnu.org; 30 Oct 2024 01:19:15 +0000 Original-Received: from localhost ([127.0.0.1]:60118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5xMf-0002fO-BU for submit@debbugs.gnu.org; Tue, 29 Oct 2024 21:19:15 -0400 Original-Received: from mout-p-202.mailbox.org ([80.241.56.172]:57258) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5vR3-0006yt-E2 for 73752@debbugs.gnu.org; Tue, 29 Oct 2024 19:15:38 -0400 Original-Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4XdR1H0zqhz9t5k for <73752@debbugs.gnu.org>; Wed, 30 Oct 2024 00:14:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=real-or-random.org; s=MBO0001; t=1730243699; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v2fG9KWEXSb7lE8rqO+k/RDmCsxmN9nDHEud64CM9cA=; b=iw5YT3qGa2sbZA2nDUxpluHOJK796msoOtDnyYhqQ+dEU1Tuv9owIzzsjMVAuK/wkWbAU6 h36M6oEeyQrxZYkwC+sfZP3dDsCq+u4f3sXUg6ilHDMGXOGUXw8HMQnVLxLx72GCCnONtt s3zZix1JaeEZJ3wWQ6wcL79BMk3IU36wCRgDwRLIIdjybb+Th/by6Ng4ruWNIaIDRTSuKR +98Maz0CcmgX0Y3Di/6k/rX1pa1BK+T/MtlbBf0kjMcTpQB/Nc8CHpFbmpgUIJxmlihAxy smQNCClpx+psCK02VDi8ZxYvjH4GOMQPHWKplVarkeXzLWtwbdJxWdJnazQXXA== X-Mailman-Approved-At: Tue, 29 Oct 2024 21:19:12 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294540 Archived-At: I regularly experience yet another "variant" of this bug. Of course, I can't be sure that is has the same cause but except for the exact distortion in the rendering, the circumstances look pretty similar.=C2=A0 I've seen the bug for a while, and I did some experiments in the past, but then I got distracted and I didn't find the time to report it properly. In fact, I see this quite often, and the xuan's test script makes this very easy to reproduce for me.=20 Here's all the meaningful information I could gather in the past. I had already posted much of this in the mentioned GitHub issue, but let me repeat here. Also, here a video that demonstrates most the following items: https://github.com/user-attachments/assets/56b15dfc-6467-4785-bf1f-f2cd05f3= 3f04 This was recorded on an old Emacs version (should be 29.1, but I can't vouch for it), but the bug has existed much longer, and I still see it on my currently installed Emacs 31.0.50 (commit 174784). * When I experience that bug, it's not only that there's additional spacing at the end of the ligature, but I see this with additional spacing after every partial "character" of the ligature (e.g., the "=3D=3D=3D" ligature is rendered rather like "=3D =3D =3D "). For some ligatures, this means that individual components are also misaligned with respect to each other. For example, the "/" in the "!=3D" (not equal) ligature, which is supposed to strike through the "=3D=3D" is vertically off. (You can see this exact problem in the right half of line 58 in the video.) * This can happen with all kinds of font changes. So the issue appears to be specific to a what I call I "realized face" with selected slope, weight, etc. (no idea what the proper Emacs term is). Ligatures may be broken in upright but not in italics, or ligatures may be broken in bold but not in normal. Once the face is broken, it stays broken.=C2=A0 * In the video, one can see that searching for "=3D" fixes the broken rendering of the "=3D=3D=3D" ligature in line 52. Contrary to the previo= us item, I believe this is *not* due to change in background color, but due to Emacs trying to highlight the individual "=3D" char. Still, it's interesting to see that this fixes the rendering. (In fact, changing the colors doesn't seem to influence the problem. I suspect that just the shapes are cached but not the colors?) * This one may be a nice for debugging: I use GNOME, and changing the font rendering settings triggers a "re-realization" of the fonts, and this will then fix the issue (again, see the video). One may be tempted to think that this should be a possibility to trigger the bug, but I could never observe this. It always fixed the problem for me, but maybe I was just "lucky". * There doesn't seem to be a way to reproduce this deterministically. I made multiple attempts to find a minimal reproducible config and fooled myself every time. I don't think this is an elisp config thing, I believe it can happen whenever there are ligatures (at least on affected systems). I've also tried multiple fonts (Iosevka, JetBrains Mono, Fira Code...). The video uses Iosevka. * Rebuilding the fontconfig cache with `fc-cache -f` or even `-r` doesn't do anything. `(clear-font-cache)` doesn't do anything (see video below). * Now that I saw this thread, I've also checked (clear-font-cache t) and (clear-composition-thread). These don't help. * If it's broken in one frame, then it's broken also in other frames.=C2= =A0 * Notably, I also use the pgtk build on wayland.=C2=A0 * I have found this on the web, which seems yet another variant (?) of the bug: https://web.archive.org/web/20230226082659/https://www.reddit.com/r/emac= s/comments/11c957r/ligatures_character_overlap_and_extreme_squashing/ I've just managed to reproduce this again, and I've attached gdb, but I'm also stuck at pp doesn't displaying: (gdb) pp composition_gstring_from_id(19) (gdb) p composition_gstring_from_id(19) $6 =3D (struct Lisp_X *) 0x58ad4d938225 (gdb) xpr Lisp_Vectorlike PVEC_NORMAL_VECTOR $7 =3D (struct Lisp_Vector *) 0x58ad4d938220 {XIL(0x58ad4f32aabd), make_fixnum(19), XIL(0x58ad4d93f8e5), XIL(0x58ad4d93f93d), XIL(0x58ad4d93f995)} I still have the session open. Also happy to rebuild with more debug info enabled, if you tell me how that works. ``` 3.24.43, cairo version 1.18.2) of 2024-09-13 built on tonno.fritz.box Repository revision: 04e8ad6489ebec121ace7ea6d582429a96af8f04 Repository branch: makepkg System Description: Arch Linux Configured using: 'configure --prefix=3D/usr --sysconfdir=3D/etc --libexecdir=3D/usr/lib --localstatedir=3D/var --mandir=3D/usr/share/man --with-gameuser=3D:games --with-modules --without-m17n-flt --without-gconf --with-native-compilation=3Dyes --with-xinput2 --with-pgtk --without-xaw3d --with-sound=3Dno --with-tree-sitter --without-gpm --without-compress-install '--program-transform-name=3Ds/\([ec]tags\)/\1.emacs/' 'CFLAGS=3D-march=3Dnative -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3D3 -Wformat -Werror=3Dformat-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=3D/home/tim/.cache/pikaur/build/emacs- git/src=3D/usr/src/debug/emacs-git -flto=3Dauto' 'LDFLAGS=3D-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=3Dauto' 'CXXFLAGS=3D-march=3Dnative -O2 -pipe -fno-plt -fexceptions -Wp,-D_FORTIFY_SOURCE=3D3 -Wformat -Werror=3Dformat-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wp,-D_GLIBCXX_ASSERTIONS -g -ffile-prefix-map=3D/home/tim/.cache/pikaur/build/emacs- git/src=3D/usr/src/debug/emacs-git -flto=3Dauto'' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LCMS2 LIBOTF LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB ```