Mercurial > emacs
changeset 55124:ff3536099b37
(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.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 24 Apr 2004 23:28:10 +0000 |
parents | a27729919ff1 |
children | 30d05d8a4694 |
files | src/xdisp.c |
diffstat | 1 files changed, 45 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xdisp.c Sat Apr 24 23:06:03 2004 +0000 +++ b/src/xdisp.c Sat Apr 24 23:28:10 2004 +0000 @@ -850,7 +850,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 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 @@ /* 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 @@ end of the line if the row ends in italic text. */ static int -append_space (it, default_face_p) - struct it *it; - int default_face_p; +append_space_for_newline (it) + struct it *it; { if (FRAME_WINDOW_P (it->f)) { @@ -14172,7 +14170,7 @@ /* 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 @@ 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 @@ 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 @@ /* 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 @@ 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 @@ } 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 @@ 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) - { - it->ascent = it->descent = 0; + if (EQ (lsp, Qt)) + { + 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; - - 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; + 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 (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 @@ 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);