GNU bug report logs - #54688
29.0.50; Sliced image in margin looks bad

Previous Next

Package: emacs;

Reported by: dalanicolai <dalanicolai <at> gmail.com>

Date: Sun, 3 Apr 2022 06:57:02 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: dalanicolai <dalanicolai <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 54688 <at> debbugs.gnu.org
Subject: bug#54688: 29.0.50; Sliced image in margin looks bad
Date: Sun, 3 Apr 2022 12:33:01 +0200
[Message part 1 (text/plain, inline)]
Thank you for the quick reply. However, the height of the image,
(* 2 (line-pixel-height)), is equal to twice the `default-font-height`
(the 'line-pixel-height' and 'default-font-height' are equal, here both
17).

So before I add the character after the image, (line-pixel-height)
returns 17. But when I insert a character after it (with
'default-font-height' is 17), the `line-pixel-height` increases to
22. So I am not sure how to not let the line height increase.
I will try to play a little with the :ascent value.

On Sun, 3 Apr 2022 at 10:57, Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: dalanicolai <dalanicolai <at> gmail.com>
> > 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.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.