unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: gerd.moellmann@t-online.de (Gerd Moellmann)
Cc: emacs-devel@gnu.org
Subject: Re: variable line spacing
Date: 10 Mar 2002 15:54:20 +0100	[thread overview]
Message-ID: <864rjo5v8j.fsf@gerd.dnsq.org> (raw)
In-Reply-To: <20020310.103114.71101308.wl@gnu.org>

Werner LEMBERG <wl@gnu.org> writes:

>     Currently, it automatically increases the line spacing by one
>     pixel above and below for such lines.

Doesn't this mix up two functionalities?  It might be cleaner to
separate this into two issues: no overlapping lines, and additional
space between lines.

> Index: src/buffer.c
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/src/buffer.c,v
> retrieving revision 1.380
> diff -u -r1.380 buffer.c
> --- src/buffer.c	4 Mar 2002 23:20:06 -0000	1.380
> +++ src/buffer.c	7 Mar 2002 05:39:32 -0000

[...]

> +static void
> +x_set_line_spacing_no_overlap (f, arg, oldval)
> +     struct frame *f;
> +     Lisp_Object arg, oldval;
> +{
> +  f->line_spacing_no_overlap_p = !EQ (Qnil, arg);
>  }

(Using NILP is preferred to EQ (Qnil, ...).)

> Index: src/xterm.c
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
> retrieving revision 1.710
> diff -u -r1.710 xterm.c
> --- src/xterm.c	4 Mar 2002 23:40:59 -0000	1.710
> +++ src/xterm.c	7 Mar 2002 05:42:29 -0000
> @@ -2323,8 +2323,9 @@
>    xassert (it->ascent >= 0 && it->descent >= 0);
>    if (it->area == TEXT_AREA)
>      it->current_x += it->pixel_width;
> -  
> -  it->descent += it->extra_line_spacing;
> +
> +  it->ascent += it->extra_line_spacing / 2;
> +  it->descent += it->extra_line_spacing - it->extra_line_spacing / 2;
>    
>    it->max_ascent = max (it->max_ascent, it->ascent);
>    it->max_descent = max (it->max_descent, it->descent);

Hm, now that I see the code, I think it is more correct to do the line
height changes exclusively here, also for the non-overlapping case.
The reason for this is that some computations over text (the move_*
functions in xdisp.c) need to know line heights, but there are no
glyph rows, only the iterator.  That's also the reason why I did the
extra_line_spacing stuff here.  Sorry for setting you on the wrong
track; I'm apparently already swapping out the very basics of what
I coded.

If you compute IT's ascent, descent, max_ascent, and max_descent from
the physical ascent and descent in x_produce_glyhs, this prevents
overlapping because these values are used for the height and ascent of
glyph rows.  And the code in compute_line_metrics increasing the first
row's height doesn't run then, because there is no overlap.  There
should also be no need to do anything special in other functions in
xdisp.c or xterm.c, AFAIR.

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel


      reply	other threads:[~2002-03-10 14:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-10  9:31 variable line spacing Werner LEMBERG
2002-03-10 14:54 ` Gerd Moellmann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=864rjo5v8j.fsf@gerd.dnsq.org \
    --to=gerd.moellmann@t-online.de \
    --cc=emacs-devel@gnu.org \
    --cc=gerd@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).