emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variable line spacing


From: Gerd Moellmann
Subject: Re: variable line spacing
Date: 10 Mar 2002 15:54:20 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.50

Werner LEMBERG <address@hidden> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]