changeset 55165:491a6ea7f8c4

(Qline_height): New variable. (syms_of_xdisp): Intern and staticpro it. (append_space_for_newline): Partially undo 2004-04-25 change; add default_face_p arg, and restore callers. Clear it->use_default_face after use. (x_produce_glyphs): Set default font for ascii char if it->use_default_font is set. Change line-spacing property to set just extra line spacing. Handle new line-height property.
author Kim F. Storm <storm@cua.dk>
date Mon, 26 Apr 2004 22:05:43 +0000
parents 25c220642eae
children aa6b7bfc426e
files src/xdisp.c
diffstat 1 files changed, 60 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/xdisp.c	Mon Apr 26 22:05:15 2004 +0000
+++ b/src/xdisp.c	Mon Apr 26 22:05:43 2004 +0000
@@ -304,6 +304,7 @@
 Lisp_Object Qslice;
 Lisp_Object Qcenter;
 Lisp_Object Qmargin, Qpointer;
+Lisp_Object Qline_height;
 extern Lisp_Object Qheight;
 extern Lisp_Object QCwidth, QCheight, QCascent;
 extern Lisp_Object Qscroll_bar;
@@ -850,7 +851,7 @@
 static struct glyph_row *get_overlay_arrow_glyph_row P_ ((struct window *,
 							  Lisp_Object));
 static void extend_face_to_end_of_line P_ ((struct it *));
-static int append_space_for_newline P_ ((struct it *));
+static int append_space_for_newline P_ ((struct it *, int));
 static int make_cursor_line_fully_visible P_ ((struct window *, int));
 static int try_scrolling P_ ((Lisp_Object, int, EMACS_INT, EMACS_INT, int, int));
 static int try_cursor_movement P_ ((Lisp_Object, struct text_pos, int *));
@@ -14157,8 +14158,9 @@
    end of the line if the row ends in italic text.  */
 
 static int
-append_space_for_newline (it)
-     struct it *it;
+append_space_for_newline (it, default_face_p)
+     struct it *it;
+     int default_face_p;
 {
   if (FRAME_WINDOW_P (it->f))
     {
@@ -14188,16 +14190,16 @@
 	  it->c = ' ';
 	  it->len = 1;
 
-	  if (it->face_before_selective_p)
+	  if (default_face_p)
+	    it->face_id = DEFAULT_FACE_ID;
+	  else if (it->face_before_selective_p)
 	    it->face_id = it->saved_face_id;
 	  face = FACE_FROM_ID (it->f, it->face_id);
 	  it->face_id = FACE_FOR_CHAR (it->f, face, 0);
 
-	  if (it->max_ascent > 0 || it->max_descent > 0)
-	    it->constrain_row_ascent_descent_p = 1;
-
 	  PRODUCE_GLYPHS (it);
 
+	  it->use_default_face = 0;
 	  it->constrain_row_ascent_descent_p = 0;
 	  it->current_x = saved_x;
 	  it->object = saved_object;
@@ -14480,7 +14482,7 @@
 	    row->exact_window_width_line_p = 1;
 	  else
 #endif /* HAVE_WINDOW_SYSTEM */
-	  if ((append_space_for_newline (it) && row->used[TEXT_AREA] == 1)
+	  if ((append_space_for_newline (it, 1) && row->used[TEXT_AREA] == 1)
 	      || row->used[TEXT_AREA] == 0)
 	    {
 	      row->glyphs[TEXT_AREA]->charpos = -1;
@@ -14722,7 +14724,7 @@
 	  /* Add a space at the end of the line that is used to
 	     display the cursor there.  */
 	  if (!IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
-	    append_space_for_newline (it);
+	    append_space_for_newline (it, 0);
 #endif /* HAVE_WINDOW_SYSTEM */
 
 	  /* Extend the face to the end of the line.  */
@@ -18588,6 +18590,12 @@
 
 	  it->nglyphs = 1;
 
+	  if (it->use_default_face)
+	    {
+	      font = FRAME_FONT (it->f);
+	      boff = FRAME_BASELINE_OFFSET (it->f);
+	    }
+
 	  pcm = rif->per_char_metric (font, &char2b,
 				      FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
 
@@ -18611,19 +18619,19 @@
 	  if (it->constrain_row_ascent_descent_p)
 	    {
 	      if (it->descent > it->max_descent)
-		{
-		  it->ascent += it->descent - it->max_descent;
-		  it->descent = it->max_descent;
-		}
-	      if (it->ascent> it->max_ascent)
-		{
-		  it->descent = min (it->max_descent, it->descent + it->ascent - it->max_ascent);
-		  it->ascent = it->max_ascent;
-		}
-	      it->phys_ascent = min (it->phys_ascent, it->ascent);
-	      it->phys_descent = min (it->phys_descent, it->descent);
-	      extra_line_spacing = 0;
-	    }
+ 		{
+ 		  it->ascent += it->descent - it->max_descent;
+ 		  it->descent = it->max_descent;
+ 		}
+ 	      if (it->ascent > it->max_ascent)
+ 		{
+ 		  it->descent = min (it->max_descent, it->descent + it->ascent - it->max_ascent);
+ 		  it->ascent = it->max_ascent;
+ 		}
+ 	      it->phys_ascent = min (it->phys_ascent, it->ascent);
+ 	      it->phys_descent = min (it->phys_descent, it->descent);
+ 	      extra_line_spacing = 0;
+  	    }
 
 	  /* If this is a space inside a region of text with
 	     `space-width' property, change its width.  */
@@ -18695,34 +18703,44 @@
 	     But if previous part of the line set a height, don't
 	     increase that height */
 
-	  Lisp_Object lsp;
+	  Lisp_Object lsp, lh;
 
 	  it->pixel_width = 0;
 	  it->nglyphs = 0;
 
-	  lsp = Fget_text_property (IT_CHARPOS (*it), Qline_spacing, it->w->buffer);
+	  lh = Fget_text_property (IT_CHARPOS (*it), Qline_height, it->w->buffer);
+
+	  if (EQ (lh, Qt))
+	    {
+	      it->use_default_face = 1;
+	      font = FRAME_FONT (it->f);
+	      boff = FRAME_BASELINE_OFFSET (it->f);
+	      font_info = NULL;
+	    }
 
 	  it->ascent = FONT_BASE (font) + boff;
 	  it->descent = FONT_DESCENT (font) - boff;
 
-	  if (EQ (lsp, Qt))
+	  if (EQ (lh, make_number (0)))
 	    {
 	      if (it->descent > it->max_descent)
 		{
 		  it->ascent += it->descent - it->max_descent;
 		  it->descent = it->max_descent;
 		}
-	      if (it->ascent> it->max_ascent)
+	      if (it->ascent > it->max_ascent)
 		{
 		  it->descent = min (it->max_descent, it->descent + it->ascent - it->max_ascent);
 		  it->ascent = it->max_ascent;
 		}
 	      it->phys_ascent = min (it->phys_ascent, it->ascent);
 	      it->phys_descent = min (it->phys_descent, it->descent);
+	      it->constrain_row_ascent_descent_p = 1;
 	      extra_line_spacing = 0;
 	    }
 	  else
 	    {
+	      int explicit_height = -1;
 	      it->phys_ascent = it->ascent;
 	      it->phys_descent = it->descent;
 
@@ -18733,11 +18751,20 @@
 		  it->ascent += face->box_line_width;
 		  it->descent += face->box_line_width;
 		}
-	      if (INTEGERP (lsp))
-		extra_line_spacing = XINT (lsp);
-	      else if (FLOATP (lsp))
-		extra_line_spacing = (it->phys_ascent + it->phys_descent) * XFLOAT_DATA (lsp);
-	    }
+	      if (INTEGERP (lh))
+		explicit_height = XINT (lh);
+	      else if (FLOATP (lh))
+		explicit_height = (it->phys_ascent + it->phys_descent) * XFLOAT_DATA (lh);
+
+	      if (explicit_height > it->ascent + it->descent)
+		it->ascent = explicit_height - it->descent;
+	    }
+
+	  lsp = Fget_text_property (IT_CHARPOS (*it), Qline_spacing, it->w->buffer);
+	  if (INTEGERP (lsp))
+	    extra_line_spacing = XINT (lsp);
+	  else if (FLOATP (lsp))
+	    extra_line_spacing = (it->phys_ascent + it->phys_descent) * XFLOAT_DATA (lsp);
 	}
       else if (it->char_to_display == '\t')
 	{
@@ -21760,6 +21787,8 @@
   staticpro (&Qright_margin);
   Qcenter = intern ("center");
   staticpro (&Qcenter);
+  Qline_height = intern ("line-height");
+  staticpro (&Qline_height);
   QCalign_to = intern (":align-to");
   staticpro (&QCalign_to);
   QCrelative_width = intern (":relative-width");