changeset 55357:cec2c6c3bafb

(Qtotal): New var. (syms_of_xdisp): Intern and staticpro it. (calc_line_height_property): New arg total. Set it if line-spacing property has format (total . VALUE). (x_produce_glyphs): Ignore line-spacing if line-height is 0. Handle total line-spacing property.
author Kim F. Storm <storm@cua.dk>
date Tue, 04 May 2004 12:51:45 +0000
parents d4351d019f6d
children 661d7ab25c0e
files src/xdisp.c
diffstat 1 files changed, 24 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Tue May 04 08:18:54 2004 +0000
+++ b/src/xdisp.c	Tue May 04 12:51:45 2004 +0000
@@ -304,7 +304,7 @@
 Lisp_Object Qslice;
 Lisp_Object Qcenter;
 Lisp_Object Qmargin, Qpointer;
-Lisp_Object Qline_height;
+Lisp_Object Qline_height, Qtotal;
 extern Lisp_Object Qheight;
 extern Lisp_Object QCwidth, QCheight, QCascent;
 extern Lisp_Object Qscroll_bar;
@@ -18523,11 +18523,11 @@
    Returns height in pixels, or nil.  */
 
 static Lisp_Object
-calc_line_height_property (it, prop, font, boff)
+calc_line_height_property (it, prop, font, boff, total)
      struct it *it;
      Lisp_Object prop;
      XFontStruct *font;
-     int boff;
+     int boff, *total;
 {
   Lisp_Object val;
   Lisp_Object face_name = Qnil;
@@ -18539,6 +18539,12 @@
   if (NILP (val))
     return val;
 
+  if (total && CONSP (val) && EQ (XCAR (val), Qtotal))
+    {
+      *total = 1;
+      val = XCDR (val);
+    }
+
   if (INTEGERP (val))
     return val;
 
@@ -18807,13 +18813,13 @@
 	     But if previous part of the line set a height, don't
 	     increase that height */
 
-	  Lisp_Object height, spacing;
+	  Lisp_Object height;
 
 	  it->override_ascent = -1;
 	  it->pixel_width = 0;
 	  it->nglyphs = 0;
 
-	  height = calc_line_height_property(it, Qline_height, font, boff);
+	  height = calc_line_height_property(it, Qline_height, font, boff, 0);
 
 	  if (it->override_ascent >= 0)
 	    {
@@ -18846,6 +18852,9 @@
 	    }
 	  else
 	    {
+	      Lisp_Object spacing;
+	      int total = 0;
+
 	      it->phys_ascent = it->ascent;
 	      it->phys_descent = it->descent;
 
@@ -18859,16 +18868,14 @@
 	      if (!NILP (height)
 		  && XINT (height) > it->ascent + it->descent)
 		it->ascent = XINT (height) - it->descent;
-	    }
-
-	  spacing = calc_line_height_property(it, Qline_spacing, font, boff);
-	  if (!NILP (spacing))
-	    {
-	      int sp = XINT (spacing);
-	      if (sp < 0)
-		extra_line_spacing = (-sp) - (it->phys_ascent + it->phys_descent);
-	      else
-		extra_line_spacing = sp;
+
+	      spacing = calc_line_height_property(it, Qline_spacing, font, boff, &total);
+	      if (INTEGERP (spacing))
+		{
+		  extra_line_spacing = XINT (spacing);
+		  if (total)
+		    extra_line_spacing -= (it->phys_ascent + it->phys_descent);
+		}
 	    }
 	}
       else if (it->char_to_display == '\t')
@@ -21894,6 +21901,8 @@
   staticpro (&Qcenter);
   Qline_height = intern ("line-height");
   staticpro (&Qline_height);
+  Qtotal = intern ("total");
+  staticpro (&Qtotal);
   QCalign_to = intern (":align-to");
   staticpro (&QCalign_to);
   QCrelative_width = intern (":relative-width");