From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: dalanicolai Newsgroups: gmane.emacs.bugs Subject: bug#54688: 29.0.50; Sliced image in margin looks bad Date: Sun, 3 Apr 2022 13:04:55 +0200 Message-ID: References: <83zgl235pb.fsf@gnu.org> <83v8vq30aa.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000000426ab05dbbdfc86" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12558"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 54688@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 03 13:06:29 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nay3w-00035K-M0 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Apr 2022 13:06:28 +0200 Original-Received: from localhost ([::1]:50834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nay3v-0003gP-Hy for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Apr 2022 07:06:27 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nay3W-0003f8-Ic for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2022 07:06:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53826) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nay3W-0002OE-AM for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2022 07:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nay3W-00050H-2h for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2022 07:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: dalanicolai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Apr 2022 11:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54688 X-GNU-PR-Package: emacs Original-Received: via spool by 54688-submit@debbugs.gnu.org id=B54688.164898391419158 (code B ref 54688); Sun, 03 Apr 2022 11:06:02 +0000 Original-Received: (at 54688) by debbugs.gnu.org; 3 Apr 2022 11:05:14 +0000 Original-Received: from localhost ([127.0.0.1]:47717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nay2j-0004yv-MP for submit@debbugs.gnu.org; Sun, 03 Apr 2022 07:05:14 -0400 Original-Received: from mail-yb1-f182.google.com ([209.85.219.182]:44804) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nay2i-0004yg-Ef for 54688@debbugs.gnu.org; Sun, 03 Apr 2022 07:05:13 -0400 Original-Received: by mail-yb1-f182.google.com with SMTP id x131so212302ybe.11 for <54688@debbugs.gnu.org>; Sun, 03 Apr 2022 04:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MbhmdAQruwMk7Da9Z3zjgIvymhb8+kJbAzC9mDayvdo=; b=VLYQXuY8Ff3xqluKM9L2IbGi12Pe+ljcU1ub3xvA6nrxma8BlGvvgMmRWf3ZiS0WsJ 600fihwtrJtALXf8REN4RmY34hBqK3mPHoCSnoyyPHBXZovHi9PG3imL+ClJHHoatb3h EUhXL3Zf07EOfXX7KGbVA7a6rY000qnxmY3nQ4iRZtfuQEo7iYNY5iz6U46TUZWGUlF7 l7+LnRWnv9eyh9f6A5PxncQ7vNNVccYoWqS59NwsraZ/GeUyJjByo4RCasjUHwXrnOja h3NZ6W97ODERe1mKl0sgY1ksLN/QBKau/cQFBNYzv5DstMXP5la1OEk9fcjVtZmr7WKW AEMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MbhmdAQruwMk7Da9Z3zjgIvymhb8+kJbAzC9mDayvdo=; b=kmR4IyWiXOeDx6/JjUA6B+Uo0yX2w0FOKiK8NAtoSJfrxwErCpG3uLITXPQ6kiR0Af lnmrMKWCLuWUbcmXX02eNLkmqftqtEn+cjNPdxqr5FgglNVNDHlnlhjSTnjA0izlUSIJ 34Ndy148DFxuZZDrh0W91h50ptk94ImbL+4cHd+5NrP99Op2CNxnNPUD/1CaVhNC1uFQ +VMjPZ0fPpTg6rxS1HUtSgMexSxjWh2wEOIWnTP6PqL8IATCBp5O/8+oPwrbC/w9BOFS vfdQ0hI/+fIwwzk6yVkpXraoRPuJuSEkq1/IoeBEAuFhhB0HbAo7jgeiEZ5llQBaFZ5R tfAg== X-Gm-Message-State: AOAM531L78Y4x+HZvkYCY2x21PlFP9xWPRzxBG7HnCMU6SFfIFhdlINy +kFKWIZGfB4eO7z/e6DpLMv+mB/1DTb1s1Spq4y5KhGIGSc= X-Google-Smtp-Source: ABdhPJwb5gJHlAA1+o0HMiPuG+DjwzLGDcKJG3vUFQ0tu9HY6WLWe7XAbjEUSl+hRrOkbmG5CvgaV9GJe34Koot9aTs= X-Received: by 2002:a25:3204:0:b0:63d:b2b3:ea7b with SMTP id y4-20020a253204000000b0063db2b3ea7bmr2457838yby.431.1648983906984; Sun, 03 Apr 2022 04:05:06 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:229330 Archived-At: --0000000000000426ab05dbbdfc86 Content-Type: text/plain; charset="UTF-8" I would think that this :ascent of 80, behaves how :ascent 50 (the default) is supposed to behave? On Sun, 3 Apr 2022 at 13:03, dalanicolai wrote: > (Once more using reply-all) > > Playing around with :ascent, makes possible to keep the line-pixel-height > fixed. > > So in the following I simply use `insert-image`. Without the :ascent, the > 'line-pixel-height' increases when inserting another character. With the > :ascent it is possible to reduce this 'increase'. For me the increase is 0 > when I use an ascent value of 80. > (below the used code) > > (with-current-buffer (get-buffer-create "test") > (setq left-margin-width 5) > (insert-image (svg-image (let* ((ph (line-pixel-height)) > (size ph) > (svg (svg-create size size))) > (svg-circle svg ph ph ph :fill "red") > svg) > :ascent 80)) > (switch-to-buffer (current-buffer))) > > On Sun, 3 Apr 2022 at 12:54, Eli Zaretskii wrote: > >> > From: dalanicolai >> > Date: Sun, 3 Apr 2022 12:33:01 +0200 >> > Cc: 54688@debbugs.gnu.org >> > >> > 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. >> >> Images can also have margins: >> >> int >> image_ascent (struct image *img, struct face *face, struct glyph_slice >> *slice) >> { >> int height; >> int ascent; >> >> if (slice->height == img->height) >> height = img->height + img->vmargin; >> else if (slice->y == 0) >> height = slice->height + img->vmargin; >> else >> height = slice->height; >> >> Maybe those make the difference? >> >> In any case, once I add a character, the line height grows, which >> tells us some vertical dimension somewhere is unaccounted for. >> > --0000000000000426ab05dbbdfc86 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I would think that this :ascent of 80, behaves how :a= scent 50 (the default)
is supposed to behave?

=
On Sun, 3 = Apr 2022 at 13:03, dalanicolai <dalanicolai@gmail.com> wrote:
(Once more using reply-all)

Playing around with :ascent, makes possible to k= eep the line-pixel-height fixed.

So in the followi= ng I simply use `insert-image`. Without the :ascent, the
'lin= e-pixel-height' increases when inserting another character. With the
:ascent it is possible to reduce this 'increase'. For me th= e increase is 0
when I use an ascent value of 80.
(belo= w the used code)

(with-current-buffer (get-b= uffer-create "test")
=C2=A0 (setq left-margin-width 5)
=C2=A0 (insert-image (svg-image (let* ((ph (line-pixel-height))
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (size ph)
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (svg (svg-create size size)))
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(svg-circle svg ph ph ph :fill "red")
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0svg)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0:ascent 8= 0))
=C2=A0 (switch-to-buffer (current-buffer)))

On Sun, 3 Apr= 2022 at 12:54, Eli Zaretskii <eliz@gnu.org> wrote:
> From: dalanicolai <dalanicolai@gmail.com>
> Date: Sun, 3 Apr 2022 12:33:01 +0200
> Cc: 54688@d= ebbugs.gnu.org
>
> 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` increase= s 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.

Images can also have margins:

=C2=A0 int
=C2=A0 image_ascent (struct image *img, struct face *face, struct glyph_sli= ce *slice)
=C2=A0 {
=C2=A0 =C2=A0 int height;
=C2=A0 =C2=A0 int ascent;

=C2=A0 =C2=A0 if (slice->height =3D=3D img->height)
=C2=A0 =C2=A0 =C2=A0 height =3D img->height + img->vmargin;
=C2=A0 =C2=A0 else if (slice->y =3D=3D 0)
=C2=A0 =C2=A0 =C2=A0 height =3D slice->height + img->vmargin;
=C2=A0 =C2=A0 else
=C2=A0 =C2=A0 =C2=A0 height =3D slice->height;

Maybe those make the difference?

In any case, once I add a character, the line height grows, which
tells us some vertical dimension somewhere is unaccounted for.
--0000000000000426ab05dbbdfc86--