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.bugs Subject: bug#67533: SVG images confound position pixel measurements Date: Fri, 01 Dec 2023 09:08:44 +0200 Message-ID: <837clybds3.fsf@gnu.org> References: <9B9C683E-B951-406E-98AA-32F4539B3FF7@gmail.com> <83o7fbb0zf.fsf@gnu.org> <6158BB83-3C05-4CEC-BF65-A6C0DEA329CD@gmail.com> 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="4539"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67533@debbugs.gnu.org To: JD Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 01 08:10:11 2023 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 1r8xf9-0000y0-4w for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Dec 2023 08:10:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r8xet-0001H3-Or; Fri, 01 Dec 2023 02:09:55 -0500 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 1r8xes-0001Gu-BK for bug-gnu-emacs@gnu.org; Fri, 01 Dec 2023 02:09:54 -0500 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 1r8xes-0000jD-0D for bug-gnu-emacs@gnu.org; Fri, 01 Dec 2023 02:09:54 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r8xf0-00025Q-3h for bug-gnu-emacs@gnu.org; Fri, 01 Dec 2023 02:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Dec 2023 07:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67533 X-GNU-PR-Package: emacs Original-Received: via spool by 67533-submit@debbugs.gnu.org id=B67533.17014145507943 (code B ref 67533); Fri, 01 Dec 2023 07:10:02 +0000 Original-Received: (at 67533) by debbugs.gnu.org; 1 Dec 2023 07:09:10 +0000 Original-Received: from localhost ([127.0.0.1]:54999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8xe9-000242-R7 for submit@debbugs.gnu.org; Fri, 01 Dec 2023 02:09:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r8xe6-00023W-Vs for 67533@debbugs.gnu.org; Fri, 01 Dec 2023 02:09:08 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r8xds-0000ab-Qc; Fri, 01 Dec 2023 02:08:52 -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=Iwah9n+gb7wMXKur6GYOdKnLclzb4M6j6ROgUsRnTS8=; b=DOq+O3dR3jpVTfB7zfh8 F17iYmpVeDd3hC5NvTebfSuMvIHxRjOXTAiKLRojqlbt/iKXAzbXbvCdW12sMWZHfbnZZtWZtS1Tx cAJijN4q9isEM2I3yf7WXNcd0aCiBwtK5TLacgM479hPVjcMIZgVuHNI4hTQ7bl6qhRqiZjYYFMwO LeW5NP6Nmx0C1ISKXK+ITliCyT48n7h/iFJmLbLz7FaJc35Cf+F9ef8Zthwkp9bWK8wUGiMEhIkGG w8dNka2p5o+0wmqqsgrlZeftk3sss2w+ZOpXObu6qT09x/g6VfHiyKfGwAcNoKdq0vDa6WFU+uGkS fvDzKQMepafWrA==; In-Reply-To: <6158BB83-3C05-4CEC-BF65-A6C0DEA329CD@gmail.com> (message from JD Smith on Thu, 30 Nov 2023 16:00:09 -0500) 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:275306 Archived-At: > From: JD Smith > Date: Thu, 30 Nov 2023 16:00:09 -0500 > Cc: 67533@debbugs.gnu.org > > > On Nov 30, 2023, at 12:32 PM, Eli Zaretskii wrote: > > > > Does the patch below fix the issue? (It should fix the recipe you > > posted, but you hinted that this is just the simplest way of seeing a > > more general problem, so I wonder whether that more general problem is > > also fixed.) > > Thanks for looking into it. As you surmised, this patch fixes only the demo case with truncate-lines. For the more general case, originally discovered with visual-line-mode on an org-mode file with many SVG preview overlays, the issue remains. In that more general case, window-text-pixel-size sometimes gives 0 or (when the image is not at the start of the visual line) a value which is too large. > > The file I can pretty readily reproduce it on here is at https://gist.github.com/jdtsmith/de34aac901fc9f96f1a88a1b1b67d46e (I use dvigms for latex preview). Only some of the preview overlay images (and other locations) exhibit the misbehavior, but more so for narrower frames with more wrapping. I’m happy to test on this end, since my pixel scrolling code finds these types of incorrect results quite instantly. As I change the window width and the text reflows, different positions exhibit the problems. > > The misbehavior extends to other regular text on the line, too, not just images. There are various possibilities for what (window-text-pixel-size nil (cons (point) -1) (point) nil nil nil t) returns: > > The correct value for position (start of line above) and (line-pixel-height) of that line. Most text does this, but not when the visual line starts with a “bad” image. > Images at line start can (but don’t always) return their own position and zero height. > On an image further right of a line-starting “bad” image, it returns the bad image position, but the full height of the line. > Some images on lines which do not start with an image return the correct position (on the prior line), but a height which is too large, as if they included some of their own height in the total. Thanks, but I need recipes I could reproduce on my system, and reproduce relatively easily. Debugging this usually takes numerous runs under GDB, so the recipe should be reasonably easy to run, so it doesn't take too long to set up a debugging session, and preferably it should not require installation of optional packages. It also cannot depend on something that doesn't work on MS-Windows, because this is the only system where I can debug a GUI Emacs. So, for example, using LaTeX Preview and dvigsm is out of the question; I need ready image files prepared by LaTeX Preview and Lisp code to display them in a way that causes problems. So please try to provide recipes for the problems you still see, after applying the patch I sent, as simple and preferably stand-alone Lisp programs that don't require to install and run all of your code. If necessary, please emulate what your package does with simplified Lisp code that just inserts text with display properties and overlays, to produce the same result as the package does. I'm sorry to insist on this and asking you to do extra work, but IME this is the only way I can debug these issues efficiently enough to solve them. I appreciate the offer to test on your end, but such testing is only useful when I have a tentative solution in hand for you to test. Such a tentative solution must be based on some problem I found and fixed here, and for that I must be able to step through the offending code in GDB. Thanks.