From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yixuan Chen Newsgroups: gmane.emacs.bugs Subject: bug#73752: 29.4; Ligatures are randomly rendered with extra spaces Date: Mon, 28 Oct 2024 11:24:33 -0400 Message-ID: <7f6a1b90-ae44-4761-92df-e3fe8a27d96d@xlk.me> References: <86zfn9ycis.fsf@gnu.org> <86o735als7.fsf@gnu.org> <87o73534dn.fsf@gmail.com> <86h68x8nuz.fsf@gnu.org> <86ed418niu.fsf@gnu.org> <87jzds3lay.fsf@gmail.com> <86iktc6zp5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23333"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: luangruo@yahoo.com, 73752@debbugs.gnu.org To: Eli Zaretskii , Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 28 18:50:58 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 1t5TtH-0005qo-LD for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 28 Oct 2024 18:50:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5Tss-0002S7-91; Mon, 28 Oct 2024 13:50:30 -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 1t5Tsp-0002RP-PF for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 13:50:28 -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 1t5Tso-0000Ee-AJ for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 13:50:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=LuPgK4wx9X9OiTW/d+39riLllpDU4+ZqmblgXC7DyB4=; b=Bef3+C3UUgPDwMgXhpsR3BKnDwthO1rak+vBHAERuUctvZr4lmKb128lzbRpawU2vmJ3s+wEoSQeHihstyQjVMmfp6DU5V4APtrWFwhjusFglZ5OebmUQba/kV/wHIMAPIMF2CHlthbn/lWMAJZW0+HtmSMi+/HJ6zVDPPmwyi//jwd8plvERez256a1XwMmFg/wrh7Z+zRHz77FvwD9tIugGt3EykEFzJK7FoeavuMVu1sc1nJz77WNX6P6+eoURV7xuK4vqH1baiN1dd0eOWSSaC4yLpKRF+79TsqcKdjM9sIfqx2eXBjBtdRmUnzGwpDqv8nj0dlHUss+iKtS6w==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t5TtO-0004C5-LI for bug-gnu-emacs@gnu.org; Mon, 28 Oct 2024 13:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yixuan Chen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 28 Oct 2024 17:51:02 +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.173013780515680 (code B ref 73752); Mon, 28 Oct 2024 17:51:02 +0000 Original-Received: (at 73752) by debbugs.gnu.org; 28 Oct 2024 17:50:05 +0000 Original-Received: from localhost ([127.0.0.1]:54641 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5TsR-00044i-0r for submit@debbugs.gnu.org; Mon, 28 Oct 2024 13:50:05 -0400 Original-Received: from qs51p00im-qukt01080301.me.com ([17.57.155.20]:11025) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5RcM-0005t8-Pd for 73752@debbugs.gnu.org; Mon, 28 Oct 2024 11:25:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xlk.me; s=sig1; t=1730129077; bh=LuPgK4wx9X9OiTW/d+39riLllpDU4+ZqmblgXC7DyB4=; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; b=oE62/556H+jc2FFG+jL2b7krHBqjiOhJ0GSoBpJKndh1ZVSH3kjSuJ7jibfJrBr1A VLr4D8bXZmzHfrebqfn+Wy5S2LBw6bHfEVU1k9VafIgxwcmhQ9GIFtH9g0qQ6sl8OL KeslFnfHhNsPGUusrR02SzdhmN6xKSGnf6f/6g/aPJbi4y9ujLFJ8GBgXJUPcklXSm CxmHrtcCez5xTWrj51C2LHJuDn2aI4p2F09DmOCBf2iAGV4x9zCMvWRMlhJCfq1xdp FdNb3o8gyPUQF9H0au7rLEmWX7jGCl+6KUQLlqNMj9jCzriHDJgIrSteLRAtEx9yUX gm0HbGQXwHXLQ== Original-Received: from [192.168.1.14] (qs51p00im-dlb-asmtp-mailmevip.me.com [17.57.155.28]) by qs51p00im-qukt01080301.me.com (Postfix) with ESMTPSA id 21C295F00529; Mon, 28 Oct 2024 15:24:34 +0000 (UTC) Content-Language: en-US In-Reply-To: <86iktc6zp5.fsf@gnu.org> X-Proofpoint-ORIG-GUID: qGnsWoFPKEpfLQsKmiehjrhcdXfWzCY5 X-Proofpoint-GUID: qGnsWoFPKEpfLQsKmiehjrhcdXfWzCY5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-28_04,2024-10-28_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 mlxscore=0 mlxlogscore=552 clxscore=1030 adultscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2308100000 definitions=main-2410280123 X-Mailman-Approved-At: Mon, 28 Oct 2024 13:49:59 -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:294445 Archived-At: On 10/28/24 10:59, Eli Zaretskii wrote: >> From: Visuwesh >> Cc: luangruo@yahoo.com, 73752@debbugs.gnu.org, xuan@xlk.me >> Date: Mon, 28 Oct 2024 09:56:13 +0530 >> >> Real-life Lisp programs certainly do not change face font attributes so >> often but I believe the script does it so to reproduce the issue >> quickly. In a regular Emacs session, it is enough for the same text to >> be shown in different font sizes (as a consequence of using C-x C-+) and >> font weights to eventually exhibit this misalignment IME. > > You need to catch this situation in some reproducible recipe. Because > up front I don't understand how is this possible: we cache each > composition with its font object, which includes the font size (and > also slant, weight, etc.), so a different variant of the same font > ought to match only cache entries that use the exact same font. Or > maybe I don't understand well enough what > composition_gstring_put_cache does to compute the hash of a > glyph-string header (which is the hash key for a composition)? > >> I do not understand the technical details but the width of the glyph >> used to draw it is not the one that should be used for the underlying >> font (weight, size, etc. included) which leads to this misalignment. > > Which seems to indicate that we somehow use a different font's metric. > >> To make it more clear, let's say that =:= is shaped for a font X with a >> specific weight, size, etc. At a later point in time, the width of the >> glyph corresponding to X is used to draw =:= with font Y of same family. >> This leads to the observed misalignment AFAIU. > > But how can this happen? Without a reproducible recipe, which can be > reproduced without waiting for too long, it is very hard to > investigate this. Just my uninformed opinion. Considering, - the fact that it's hard to reproduce the problem (the script I submitted is the best way to trigger the problem to my knowledge since it reproduces on multiple people's emacs consistently), - the non-deterministic nature of this bug, - changing fonts rapidly seems to help triggering the bug, - my personal research bias, This sounds like a concurrency problem, such as some kind of race condition leading to cache being over-written or else. But I have zero idea on how emacs works internally, so I can be completely wrong.