unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: JD Smith <jdtsmith@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 67533@debbugs.gnu.org
Subject: bug#67533: SVG images confound position pixel measurements
Date: Sat, 2 Dec 2023 08:36:07 -0500	[thread overview]
Message-ID: <906A480A-85B4-4AB0-B2E3-1533A48C228D@gmail.com> (raw)
In-Reply-To: <83wmtx83io.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 3515 bytes --]



> On Dec 2, 2023, at 2:30 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: JD Smith <jdtsmith@gmail.com>
>> Date: Fri, 1 Dec 2023 17:04:59 -0500
>> 
>> On Dec 1, 2023, at 2:08 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>> 
>> Thanks, but I need recipes I could reproduce on my system, and
>> reproduce relatively easily.  
>> 
>> Please find a stand-alone reproduction code which can separately test both text-property and overlay
>> inline SVGs at this gist.  See the header for instructions.  
> 
> Thanks, but I'd appreciate more focused pointers to specific problems,
> see below.  I also seem to be unable to reproduce the problems(?).

Strange.  Both of my ports here (NS and Mac) show the same issue.  Did you check the svg-pixel-demo-report buffer the header mentions, where the mismatch measurement information gets reported?  The specific problems encountered are listed in the report buffer, updated with my/check-buffer-pixel-values.  For example, at a standard width of 80 characters, I get this report:

SVG Position analysis for svg-pixel-demo (width 80, text-properties)

Incorrect at point= 34: line  2 at   (224 . 14) (image): expected 14 got 28
Incorrect at point= 99: line  3 at   (244 . 43) (image): expected 29 got 46
Incorrect at point=126: line  4 at    (42 . 75) (image): expected 32 got 46
Incorrect at point=162: line  4 at   (345 . 75) (image): expected 32 got 52
Incorrect at point=210: line  5 at  (133 . 110) (image): expected 35 got 49

So in this case, 5 of the image locations (of 7) are showing sizes of entities one pixel above them as too large (with sizes sometimes not matching any line height).  At small window widths (like 25-30 characters) many zero heights start showing up.   Running the check in a normal text window produces an empty report (no errors). 

> When I run "M-x my/check-buffer-pixel-values" in the buffer created by
> "M-x my/test-svg-positions", all I see is a single message "End of
> buffer", nothing else.  

Perhaps you did not check the report buffer? I usually am opening that in another frame. 

> Also, your test file doesn't use lexical-binding -- should it?  Or
> does it not matter for the purposes of reproducing these issues?

I neglected that.  I don’t think it makes a difference, but have now included it, and fixed a couple of resulting unused variable complaints.  Please re-download the gist <https://gist.github.com/jdtsmith/ad765047a6afe20f353de573d8c07da9> and try it again to be sure.

>> The one bug in my original org file I haven’t been able to reproduce is random text characters (usually
>> on a line with a bad image) misreporting pixel measurements.
> 
> Misreporting pixel measurements of what?

Same thing as for the images: the pixel heights of the entity at an offset of -1 pixels.  In the demo code I’ve written, this seems to occur only on characters with image 'display (overlay/text-property).  In my (much larger) org mode with latex preview file, it sometimes happens on regular text characters.  I’m hoping/expecting whatever fix we find for this problem corrects that too. 

>> BTW, I haven’t tested it, but I do not think this misbehavior is specific to SVG images.
> 
> I don't think it is.  The display engine has no idea about the source
> of the image data, all it cares about is that it is an image of a
> given size and given attributes.

Makes sense.  That comports with the fact that I’ve seen similar issues with PNG overlays.


[-- Attachment #2: Type: text/html, Size: 5167 bytes --]

  reply	other threads:[~2023-12-02 13:36 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E44B7B4B-8FE9-41EB-BF7B-93AC5EAEAC07@gmail.com>
2023-11-29 20:31 ` bug#67533: SVG images confound position pixel measurements JD Smith
2023-11-30 17:32   ` Eli Zaretskii
2023-11-30 21:00     ` JD Smith
2023-12-01  7:08       ` Eli Zaretskii
2023-12-01 22:04         ` JD Smith
2023-12-02  7:30           ` Eli Zaretskii
2023-12-02 13:36             ` JD Smith [this message]
2023-12-02 14:18               ` Eli Zaretskii
2023-12-02 19:39                 ` Eli Zaretskii
2023-12-02 21:44                   ` JD Smith
2023-12-03  3:04                     ` JD Smith
2023-12-03 13:02                       ` Eli Zaretskii
2023-12-03 15:48                         ` JD Smith
2023-12-03 15:52                           ` Eli Zaretskii
2023-12-03 16:31                             ` Eli Zaretskii
2023-12-03 21:25                               ` JD Smith
2023-12-03 23:14                                 ` JD Smith
2023-12-04  3:27                                 ` Eli Zaretskii
2023-12-04  4:32                                   ` JD Smith
2023-12-04 13:11                                     ` Eli Zaretskii
2023-12-04 14:14                                       ` JD Smith
2023-12-16  9:32                                         ` Eli Zaretskii
2023-12-16 15:07                                           ` JD Smith
2023-12-16 15:23                                             ` Eli Zaretskii
2023-12-03 15:49                         ` JD Smith
2023-12-03 16:33                           ` Eli Zaretskii
2023-12-03 18:58                             ` JD Smith
2023-12-01 14:40     ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-01 14:55       ` Eli Zaretskii
2023-12-01 15:21         ` JD Smith
2023-12-01 15:36           ` Eli Zaretskii
2023-12-01 15:45             ` JD Smith
2023-12-01 15:59               ` Eli Zaretskii
2023-12-01 16:17                 ` JD Smith
2023-12-01 16:30                   ` Eli Zaretskii
2023-12-01 16:27         ` Manuel Giraud via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-12-01 16:31           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=906A480A-85B4-4AB0-B2E3-1533A48C228D@gmail.com \
    --to=jdtsmith@gmail.com \
    --cc=67533@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).