Subject: bug#67533: SVG images confound position pixel measurements

From: Eli Zaretskii <[email-masked]>
Date: Sat, 02 Dec 2023 09:30:55 +0200

> From: JD Smith <[email-masked]>
> Date: Fri, 1 Dec 2023 17:04:59 -0500
> 
>  On Dec 1, 2023, at 2:08 AM, Eli Zaretskii <[email-masked]> 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(?).

> You should get many reported errors in which the size above is larger than expected, but as you
> narrow your frame and re-run the check, you’ll eventually find some images reporting 0 height above.
>  Interestingly, for the same frame width, overlays produce some of the same but overall fewer errors
> than text-properties, using precisely the same images for ‘display.

What is/are the specific problem(s) I should be looking into?  Is the
problem only the zero size when it is reported?  Or are there also
other problems, and if so, how do I recognize where and when they
happen?

> The report also reveals that the posn-x-y of the mis-reporting images is usually wrong, which is at
> least partially responsible for incorrect pixel position measurements.  

Again, can you point me to the situations when this happens and tell
how to realize it did happen?  I'd need to reproduce those specific
situations under a debugger.

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.  I've resized the frame horizontally many
times, and I still see only this single message.  So either the code
somehow doesn't work on my system, or I am missing some important part
of the reproduction recipe.

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

> 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?

> 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.