]> code.delx.au - gnu-emacs/commitdiff
(append_space_for_newline): Rename from append_space.
authorKim F. Storm <storm@cua.dk>
Sat, 24 Apr 2004 23:28:37 +0000 (23:28 +0000)
committerKim F. Storm <storm@cua.dk>
Sat, 24 Apr 2004 23:28:37 +0000 (23:28 +0000)
Remove DEFAULT_FACE_P arg; always use current face.  Callers changed.
(x_produce_glyphs): Handle line-spacing property on newline char.
If value is t, adjust ascent and descent to fit current row height.
If value is an integer or float, set extra_line_spacing to integer
value, or to float value x current line height.

src/ChangeLog
src/xdisp.c

index 3d4e320b5fbe3aaa5598a822d2268675ca068b30..44772144febd617c22b2ce8a67e4a329eea58e48 100644 (file)
@@ -1,3 +1,12 @@
+2004-04-25  Kim F. Storm  <storm@cua.dk>
+
+       * xdisp.c (append_space_for_newline): Rename from append_space.
+       Remove DEFAULT_FACE_P arg; always use current face.  Callers changed.
+       (x_produce_glyphs): Handle line-spacing property on newline char.
+       If value is t, adjust ascent and descent to fit current row height.
+       If value is an integer or float, set extra_line_spacing to integer
+       value, or to float value x current line height.
+
 2004-04-23  Kenichi Handa  <handa@m17n.org>
 
        * fontset.c (Finternal_char_font): If POSITION is nil, return
index f51727d34db798c94d4d7979d6bf65718585a1a5..e8c403d80467f8037df72b9d13248f8d372409fd 100644 (file)
@@ -850,7 +850,7 @@ static void insert_left_trunc_glyphs P_ ((struct it *));
 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 P_ ((struct it *, int));
+static int append_space_for_newline P_ ((struct it *));
 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 *));
@@ -14145,8 +14145,7 @@ compute_line_metrics (it)
 
 
 /* Append one space to the glyph row of iterator IT if doing a
-   window-based redisplay.  DEFAULT_FACE_P non-zero means let the
-   space have the default face, otherwise let it have the same face as
+   window-based redisplay.  The space has the same face as
    IT->face_id.  Value is non-zero if a space was added.
 
    This function is called to make sure that there is always one glyph
@@ -14158,9 +14157,8 @@ compute_line_metrics (it)
    end of the line if the row ends in italic text.  */
 
 static int
-append_space (it, default_face_p)
+append_space_for_newline (it)
      struct it *it;
-     int default_face_p;
 {
   if (FRAME_WINDOW_P (it->f))
     {
@@ -14172,7 +14170,7 @@ append_space (it, default_face_p)
          /* Save some values that must not be changed.
             Must save IT->c and IT->len because otherwise
             ITERATOR_AT_END_P wouldn't work anymore after
-            append_space has been called.  */
+            append_space_for_newline has been called.  */
          enum display_element_type saved_what = it->what;
          int saved_c = it->c, saved_len = it->len;
          int saved_x = it->current_x;
@@ -14190,9 +14188,7 @@ append_space (it, default_face_p)
          it->c = ' ';
          it->len = 1;
 
-         if (default_face_p)
-           it->face_id = DEFAULT_FACE_ID;
-         else if (it->face_before_selective_p)
+         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);
@@ -14484,7 +14480,7 @@ display_line (it)
            row->exact_window_width_line_p = 1;
          else
 #endif /* HAVE_WINDOW_SYSTEM */
-         if ((append_space (it, 1) && row->used[TEXT_AREA] == 1)
+         if ((append_space_for_newline (it) && row->used[TEXT_AREA] == 1)
              || row->used[TEXT_AREA] == 0)
            {
              row->glyphs[TEXT_AREA]->charpos = -1;
@@ -14726,7 +14722,7 @@ display_line (it)
          /* 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 (it, 0);
+           append_space_for_newline (it);
 #endif /* HAVE_WINDOW_SYSTEM */
 
          /* Extend the face to the end of the line.  */
@@ -18515,6 +18511,8 @@ void
 x_produce_glyphs (it)
      struct it *it;
 {
+  int extra_line_spacing = it->extra_line_spacing;
+
   it->glyph_not_available_p = 0;
 
   if (it->what == IT_CHARACTER)
@@ -18624,6 +18622,7 @@ x_produce_glyphs (it)
                }
              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
@@ -18696,31 +18695,48 @@ x_produce_glyphs (it)
             But if previous part of the line set a height, don't
             increase that height */
 
+         Lisp_Object lsp;
+
          it->pixel_width = 0;
          it->nglyphs = 0;
 
+         lsp = Fget_text_property (IT_CHARPOS (*it), Qline_spacing, it->w->buffer);
+
          it->ascent = FONT_BASE (font) + boff;
          it->descent = FONT_DESCENT (font) - boff;
 
-         if (it->max_ascent > 0 || it->max_descent > 0)
+         if (EQ (lsp, Qt))
            {
-             it->ascent = it->descent = 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)
+               {
+                 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;
            }
          else
            {
-             it->ascent = FONT_BASE (font) + boff;
-             it->descent = FONT_DESCENT (font) - boff;
-           }
-
-         it->phys_ascent = it->ascent;
-         it->phys_descent = it->descent;
+             it->phys_ascent = it->ascent;
+             it->phys_descent = it->descent;
 
-         if ((it->max_ascent > 0 || it->max_descent > 0)
-             && face->box != FACE_NO_BOX
-             && face->box_line_width > 0)
-           {
-             it->ascent += face->box_line_width;
-             it->descent += face->box_line_width;
+             if ((it->max_ascent > 0 || it->max_descent > 0)
+                 && face->box != FACE_NO_BOX
+                 && face->box_line_width > 0)
+               {
+                 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);
            }
        }
       else if (it->char_to_display == '\t')
@@ -19098,7 +19114,7 @@ x_produce_glyphs (it)
   if (it->area == TEXT_AREA)
     it->current_x += it->pixel_width;
 
-  it->descent += it->extra_line_spacing;
+  it->descent += extra_line_spacing;
 
   it->max_ascent = max (it->max_ascent, it->ascent);
   it->max_descent = max (it->max_descent, it->descent);