Subject: Re: bug#54688: 29.0.50; Sliced image in margin looks bad

From: Eli Zaretskii <[email-masked]>
Date: Sun, 03 Apr 2022 11:57:04 +0300

> From: dalanicolai <[email-masked]>
> Date: Sun, 3 Apr 2022 08:50:20 +0200
> 
> Passing 'left-margin' for the AREA parameter in `insert-sliced-image`
> results in bad looking image. To reproduce from `emacs -q` evaluate the
> following code example:
> 
> (with-current-buffer (get-buffer-create "test")
>   (setq left-margin-width 5)
>   (insert-sliced-image (svg-image (let* ((ph (line-pixel-height))
>                                          (size (* 2 ph))
>                                          (svg (svg-create size size)))
>                                     (svg-circle svg ph ph ph :fill "red")
>                                     svg))
>                        nil
>                        'left-margin
>                        2)
>   (switch-to-buffer (current-buffer)))
> 
> when instead of 'left-margin', nil is passed as value (i.e. the text is
> inserted in the text area), then everything looks fine.

"Everything looks fine" until you insert some text after the 2 slices
of the image.  That is, after evaluating the form with left-margin
replaced by nil, do this:

  C-u 2 M-g c  ;; go to buffer position 2
  x            ;; insert a character
  C-n          ;; go to next line
  x            ;; insert another character

The problem is that your images are smaller than the default height of
the screen line, as determined by the 'default' face.  So slices of
the image do not produce a single circle, but two semi-circles with
empty space between them.

If this is the problem, then I see nothing wrong with this: to have
the two slices come together, you need to fit the size of the image to
the height of the default face.