diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 5a89f4c988b..03b03d06b3e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -839,6 +839,9 @@ static void normal_char_ascent_descent (struct font *, int, int *, int *); | |||
| 839 | static void append_stretch_glyph (struct it *, Lisp_Object, | 839 | static void append_stretch_glyph (struct it *, Lisp_Object, |
| 840 | int, int, int); | 840 | int, int, int); |
| 841 | 841 | ||
| 842 | static Lisp_Object get_it_property (struct it *, Lisp_Object); | ||
| 843 | static Lisp_Object calc_line_height_property (struct it *, Lisp_Object, | ||
| 844 | struct font *, int, bool); | ||
| 842 | 845 | ||
| 843 | #endif /* HAVE_WINDOW_SYSTEM */ | 846 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 844 | 847 | ||
| @@ -19205,12 +19208,74 @@ append_space_for_newline (struct it *it, bool default_face_p) | |||
| 19205 | #ifdef HAVE_WINDOW_SYSTEM | 19208 | #ifdef HAVE_WINDOW_SYSTEM |
| 19206 | /* Make sure this space glyph has the right ascent and | 19209 | /* Make sure this space glyph has the right ascent and |
| 19207 | descent values, or else cursor at end of line will look | 19210 | descent values, or else cursor at end of line will look |
| 19208 | funny. */ | 19211 | funny, and height of empty lines will be incorrect. */ |
| 19209 | g = it->glyph_row->glyphs[TEXT_AREA] + n; | 19212 | g = it->glyph_row->glyphs[TEXT_AREA] + n; |
| 19210 | struct font *font = face->font ? face->font : FRAME_FONT (it->f); | 19213 | struct font *font = face->font ? face->font : FRAME_FONT (it->f); |
| 19211 | if (n == 0 || it->glyph_row->height < font->pixel_size) | 19214 | if (n == 0 || it->glyph_row->height < font->pixel_size) |
| 19212 | { | 19215 | { |
| 19216 | Lisp_Object height, total_height; | ||
| 19217 | int extra_line_spacing = it->extra_line_spacing; | ||
| 19218 | int boff = font->baseline_offset; | ||
| 19219 | |||
| 19220 | if (font->vertical_centering) | ||
| 19221 | boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff; | ||
| 19222 | |||
| 19223 | it->object = saved_object; /* get_it_property needs this */ | ||
| 19213 | normal_char_ascent_descent (font, -1, &it->ascent, &it->descent); | 19224 | normal_char_ascent_descent (font, -1, &it->ascent, &it->descent); |
| 19225 | /* Must do a subset of line height processing from | ||
| 19226 | x_produce_glyph for newline characters. */ | ||
| 19227 | height = get_it_property (it, Qline_height); | ||
| 19228 | if (CONSP (height) | ||
| 19229 | && CONSP (XCDR (height)) | ||
| 19230 | && NILP (XCDR (XCDR (height)))) | ||
| 19231 | { | ||
| 19232 | total_height = XCAR (XCDR (height)); | ||
| 19233 | height = XCAR (height); | ||
| 19234 | } | ||
| 19235 | else | ||
| 19236 | total_height = Qnil; | ||
| 19237 | height = calc_line_height_property (it, height, font, boff, true); | ||
| 19238 | |||
| 19239 | if (it->override_ascent >= 0) | ||
| 19240 | { | ||
| 19241 | it->ascent = it->override_ascent; | ||
| 19242 | it->descent = it->override_descent; | ||
| 19243 | boff = it->override_boff; | ||
| 19244 | } | ||
| 19245 | if (EQ (height, Qt)) | ||
| 19246 | extra_line_spacing = 0; | ||
| 19247 | else | ||
| 19248 | { | ||
| 19249 | Lisp_Object spacing; | ||
| 19250 | |||
| 19251 | it->phys_ascent = it->ascent; | ||
| 19252 | it->phys_descent = it->descent; | ||
| 19253 | if (!NILP (height) | ||
| 19254 | && XINT (height) > it->ascent + it->descent) | ||
| 19255 | it->ascent = XINT (height) - it->descent; | ||
| 19256 | |||
| 19257 | if (!NILP (total_height)) | ||
| 19258 | spacing = calc_line_height_property (it, total_height, font, | ||
| 19259 | boff, false); | ||
| 19260 | else | ||
| 19261 | { | ||
| 19262 | spacing = get_it_property (it, Qline_spacing); | ||
| 19263 | spacing = calc_line_height_property (it, spacing, font, | ||
| 19264 | boff, false); | ||
| 19265 | } | ||
| 19266 | if (INTEGERP (spacing)) | ||
| 19267 | { | ||
| 19268 | extra_line_spacing = XINT (spacing); | ||
| 19269 | if (!NILP (total_height)) | ||
| 19270 | extra_line_spacing -= (it->phys_ascent + it->phys_descent); | ||
| 19271 | } | ||
| 19272 | } | ||
| 19273 | if (extra_line_spacing > 0) | ||
| 19274 | { | ||
| 19275 | it->descent += extra_line_spacing; | ||
| 19276 | if (extra_line_spacing > it->max_extra_line_spacing) | ||
| 19277 | it->max_extra_line_spacing = extra_line_spacing; | ||
| 19278 | } | ||
| 19214 | it->max_ascent = it->ascent; | 19279 | it->max_ascent = it->ascent; |
| 19215 | it->max_descent = it->descent; | 19280 | it->max_descent = it->descent; |
| 19216 | /* Make sure compute_line_metrics recomputes the row height. */ | 19281 | /* Make sure compute_line_metrics recomputes the row height. */ |