Subject: Re: bug#59802: 30.0.50; Checkbox button not rendered

From: Stephen Berman <[email-masked]>
Date: Sun, 11 Dec 2022 23:40:38 +0100

On Sun, 11 Dec 2022 17:54:00 +0200 Eli Zaretskii <[email-masked]> wrote:

>> From: Stephen Berman <[email-masked]>
>> Cc: [email-masked],  [email-masked]
>> Date: Sun, 11 Dec 2022 14:12:09 +0100
>>
>> When I visit the SVG image file the image scales without any display
>> problem, so the problem apparently only arises with text scaling.  And
>> not just via face-remapping with text-scale-mode: when I evaluate
>> (set-face-attribute 'default nil :height 200) and then insert
>> emacs/etc/images/checked.svg with insert-image-file, the bottom half of
>> the image is truncated like in the "+4" buffer in the screenshot I
>> attached to my first post in this thread.  (When the image is displayed
>> via put-text-property, explicitly passing `:ascent center' does correct
>> the initial alignment, but on increasing the font size with `C-x C-+'
>> the image still gets pushed down just like in the screenshot I posted.)
>
> In the Custom buffers, we already use ":ascent center" for images, so
> they should scale correctly.  If they don't, the place to look is in
> the produce image_glyph function: look at the values of ascent and
> descent computed there.  Maybe something goes wrong there when the SVG
> images are scaled.

Here's what I tried and the output I got:

I started gdb with `M-x gdb' and set a breakpoint at xdisp.c:30795,
which is the first line after these two lines:

  it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face, &slice);

  it->descent = slice.height - glyph_ascent;

Then I started emacs -Q, typed `M-x customize-face RET bold RET' and hit
the breakpoint.  Now the *locals of emacs* buffer displayed this:

       struct it *           it 0x7fffffff8a70
       struct it *     it@entry 0x7fffffff8a70
    struct image *          img 0x5555563f5fb0
     struct face *         face 0x555555e5ca10
               int glyph_ascent 13
               int         crop <optimized out>
struct glyph_slice        slice { x = 0, y = 0, width = 16, height = 16 }

In the *gud-emacs* buffer I typed `pp it->ascent' and then `pp
it->descent' and the *input/output of emacs* buffers displayed this:

#<INVALID_LISP_OBJECT 0x0000000d>
#<INVALID_LISP_OBJECT 0x00000003>

In the *gud-emacs* buffer I typed `c', which immediately hit the
breakpoint again.  I then kept typing RET until the Emacs being debugged
became accessible, now showing the *Customize Face: Bold* buffer.  Now
the *locals of emacs* buffer displayed this:

       struct it *           it 0x7fffffff8a70
       struct it *     it@entry 0x7fffffff8a70
    struct image *          img 0x5555569f4dd0
     struct face *         face 0x555555e5ca10
               int glyph_ascent 12
               int         crop <optimized out>
struct glyph_slice        slice { x = 0, y = 0, width = 15, height = 15 }

In the *Customize Face: Bold* buffer I typed `C-x C-+' and hit the
breakpoint again, and the *locals of emacs* buffers now displayed this:

       struct it *           it 0x7fffffff8a70
       struct it *     it@entry 0x7fffffff8a70
    struct image *          img 0x5555560bcc00
     struct face *         face 0x5555562f4110
               int glyph_ascent 14
               int         crop <optimized out>
struct glyph_slice        slice { x = 0, y = 0, width = 16, height = 16 }

In the *gud-emacs* buffer I again typed `pp it->ascent' and then `pp
it->descent', which added the following to *input/output of emacs*:

3
0

I repeated the above steps for a few more iterations, getting similar
output: glyph_ascent ranged from 12 to 19; width and height switched
back and forth between 15 and 16; the following values of it->ascent and
it->descent were added to *input/output*:

#<INVALID_LISP_OBJECT 0x00000001>
#<INVALID_LISP_OBJECT 0x0000000f>
#<INVALID_LISP_OBJECT 0x00000001>
#<INVALID_LISP_OBJECT 0x0000000f>
#<INVALID_LISP_OBJECT 0x00000001>
#<INVALID_LISP_OBJECT 0x0000000f>
#<INVALID_LISP_OBJECT 0x00000001>
#<INVALID_LISP_OBJECT 0x00000010>
nil
4
-1
#<INVALID_LISP_OBJECT 0x00000013>
#<INVALID_LISP_OBJECT 0xfffffffffffffffd>

At this point the latter two values repeated for two iterations, then
when the *Customize* buffer became accessible again, with text scaling
at +5, I could now type `C-x C-+' without hitting the breakpoint.  I
went as far as +12, then typed `C-x C--' and when the scaling got back
down to +6 again, that hit the breakpoint again.  Now the values
returned by `pp it->ascent' and `pp it->descent' were again the last two
above.

If this isn't isn't useful, please advise me what to do.

Steve Berman