diff options
| author | Kim F. Storm | 2004-04-20 22:19:09 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-04-20 22:19:09 +0000 |
| commit | e893970b97c690266e0016c27c0ce497277e8e91 (patch) | |
| tree | ff3f5d88967bd19095fde96d300e082372bb8156 /src | |
| parent | 754dc3d8239f0badcd763c9f341237eba3a42c58 (diff) | |
| download | emacs-e893970b97c690266e0016c27c0ce497277e8e91.tar.gz emacs-e893970b97c690266e0016c27c0ce497277e8e91.zip | |
(Qslice): New variable.
(syms_of_xdisp): Intern and staticpro it.
(pos_visible_p): Return pixel position in new x and y args.
(init_iterator): Reset it->slice info.
(handle_display_prop): Parse (slice ...) property.
(push_it, pop_it): Save/restore slice info.
(make_cursor_line_fully_visible): Fix 2004-04-14 change. Do not
force repositioning of tall row if window is vscrolled, as that
would reset vscroll.
(append_space): Set it->constrain_row_ascent_descent_p to avoid
increasing row height if row is non-empty.
(fill_image_glyph_string): Copy slice info.
(take_vertical_position_into_account): Simplify.
(produce_image_glyph): Handle iterator slice info, setup glyph
slice info. Do not force minimum line height.
(x_produce_glyphs): If it->constrain_row_ascent_descent_p is set,
do not increase height (ascent/descent) of non-empty row when
adding normal character glyph; instead reduce glyph ascent/descent
appropriately; if row is higher than current glyph, adjust glyph
descent/ascent to reposition glyph within the existing row.
Likewise, when char is newline, only set ascent/descent if row is
currently empty.
(note_mouse_highlight): Handle hotspots with sliced image.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 198 |
1 files changed, 173 insertions, 25 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index a6065b542b7..f51727d34db 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -301,6 +301,7 @@ extern Lisp_Object Qface, Qinvisible, Qwidth; | |||
| 301 | Lisp_Object Vdisplay_pixels_per_inch; | 301 | Lisp_Object Vdisplay_pixels_per_inch; |
| 302 | Lisp_Object Qspace, QCalign_to, QCrelative_width, QCrelative_height; | 302 | Lisp_Object Qspace, QCalign_to, QCrelative_width, QCrelative_height; |
| 303 | Lisp_Object Qleft_margin, Qright_margin, Qspace_width, Qraise; | 303 | Lisp_Object Qleft_margin, Qright_margin, Qspace_width, Qraise; |
| 304 | Lisp_Object Qslice; | ||
| 304 | Lisp_Object Qcenter; | 305 | Lisp_Object Qcenter; |
| 305 | Lisp_Object Qmargin, Qpointer; | 306 | Lisp_Object Qmargin, Qpointer; |
| 306 | extern Lisp_Object Qheight; | 307 | extern Lisp_Object Qheight; |
| @@ -1235,9 +1236,9 @@ line_bottom_y (it) | |||
| 1235 | and header-lines heights. */ | 1236 | and header-lines heights. */ |
| 1236 | 1237 | ||
| 1237 | int | 1238 | int |
| 1238 | pos_visible_p (w, charpos, fully, exact_mode_line_heights_p) | 1239 | pos_visible_p (w, charpos, fully, x, y, exact_mode_line_heights_p) |
| 1239 | struct window *w; | 1240 | struct window *w; |
| 1240 | int charpos, *fully, exact_mode_line_heights_p; | 1241 | int charpos, *fully, *x, *y, exact_mode_line_heights_p; |
| 1241 | { | 1242 | { |
| 1242 | struct it it; | 1243 | struct it it; |
| 1243 | struct text_pos top; | 1244 | struct text_pos top; |
| @@ -1285,14 +1286,27 @@ pos_visible_p (w, charpos, fully, exact_mode_line_heights_p) | |||
| 1285 | visible_p = 1; | 1286 | visible_p = 1; |
| 1286 | *fully = bottom_y <= it.last_visible_y; | 1287 | *fully = bottom_y <= it.last_visible_y; |
| 1287 | } | 1288 | } |
| 1289 | if (visible_p && x) | ||
| 1290 | { | ||
| 1291 | *x = it.current_x; | ||
| 1292 | *y = max (top_y + it.max_ascent - it.ascent, window_top_y); | ||
| 1293 | } | ||
| 1288 | } | 1294 | } |
| 1289 | else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) | 1295 | else if (it.current_y + it.max_ascent + it.max_descent > it.last_visible_y) |
| 1290 | { | 1296 | { |
| 1297 | struct it it2; | ||
| 1298 | |||
| 1299 | it2 = it; | ||
| 1291 | move_it_by_lines (&it, 1, 0); | 1300 | move_it_by_lines (&it, 1, 0); |
| 1292 | if (charpos < IT_CHARPOS (it)) | 1301 | if (charpos < IT_CHARPOS (it)) |
| 1293 | { | 1302 | { |
| 1294 | visible_p = 1; | 1303 | visible_p = 1; |
| 1295 | *fully = 0; | 1304 | if (x) |
| 1305 | { | ||
| 1306 | move_it_to (&it2, charpos, -1, -1, -1, MOVE_TO_POS); | ||
| 1307 | *x = it2.current_x; | ||
| 1308 | *y = it2.current_y + it2.max_ascent - it2.ascent; | ||
| 1309 | } | ||
| 1296 | } | 1310 | } |
| 1297 | } | 1311 | } |
| 1298 | 1312 | ||
| @@ -1300,6 +1314,7 @@ pos_visible_p (w, charpos, fully, exact_mode_line_heights_p) | |||
| 1300 | set_buffer_internal_1 (old_buffer); | 1314 | set_buffer_internal_1 (old_buffer); |
| 1301 | 1315 | ||
| 1302 | current_header_line_height = current_mode_line_height = -1; | 1316 | current_header_line_height = current_mode_line_height = -1; |
| 1317 | |||
| 1303 | return visible_p; | 1318 | return visible_p; |
| 1304 | } | 1319 | } |
| 1305 | 1320 | ||
| @@ -2067,7 +2082,8 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) | |||
| 2067 | if (FRAME_FACE_CACHE (it->f)->used == 0) | 2082 | if (FRAME_FACE_CACHE (it->f)->used == 0) |
| 2068 | recompute_basic_faces (it->f); | 2083 | recompute_basic_faces (it->f); |
| 2069 | 2084 | ||
| 2070 | /* Current value of the `space-width', and 'height' properties. */ | 2085 | /* Current value of the `slice', `space-width', and 'height' properties. */ |
| 2086 | it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil; | ||
| 2071 | it->space_width = Qnil; | 2087 | it->space_width = Qnil; |
| 2072 | it->font_height = Qnil; | 2088 | it->font_height = Qnil; |
| 2073 | 2089 | ||
| @@ -3275,8 +3291,9 @@ handle_display_prop (it) | |||
| 3275 | } | 3291 | } |
| 3276 | 3292 | ||
| 3277 | /* Reset those iterator values set from display property values. */ | 3293 | /* Reset those iterator values set from display property values. */ |
| 3278 | it->font_height = Qnil; | 3294 | it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil; |
| 3279 | it->space_width = Qnil; | 3295 | it->space_width = Qnil; |
| 3296 | it->font_height = Qnil; | ||
| 3280 | it->voffset = 0; | 3297 | it->voffset = 0; |
| 3281 | 3298 | ||
| 3282 | /* We don't support recursive `display' properties, i.e. string | 3299 | /* We don't support recursive `display' properties, i.e. string |
| @@ -3295,6 +3312,7 @@ handle_display_prop (it) | |||
| 3295 | && !EQ (XCAR (prop), Qimage) | 3312 | && !EQ (XCAR (prop), Qimage) |
| 3296 | && !EQ (XCAR (prop), Qspace) | 3313 | && !EQ (XCAR (prop), Qspace) |
| 3297 | && !EQ (XCAR (prop), Qwhen) | 3314 | && !EQ (XCAR (prop), Qwhen) |
| 3315 | && !EQ (XCAR (prop), Qslice) | ||
| 3298 | && !EQ (XCAR (prop), Qspace_width) | 3316 | && !EQ (XCAR (prop), Qspace_width) |
| 3299 | && !EQ (XCAR (prop), Qheight) | 3317 | && !EQ (XCAR (prop), Qheight) |
| 3300 | && !EQ (XCAR (prop), Qraise) | 3318 | && !EQ (XCAR (prop), Qraise) |
| @@ -3491,6 +3509,30 @@ handle_single_display_prop (it, prop, object, position, | |||
| 3491 | it->space_width = value; | 3509 | it->space_width = value; |
| 3492 | } | 3510 | } |
| 3493 | else if (CONSP (prop) | 3511 | else if (CONSP (prop) |
| 3512 | && EQ (XCAR (prop), Qslice)) | ||
| 3513 | { | ||
| 3514 | /* `(slice X Y WIDTH HEIGHT)'. */ | ||
| 3515 | Lisp_Object tem; | ||
| 3516 | |||
| 3517 | if (FRAME_TERMCAP_P (it->f) || FRAME_MSDOS_P (it->f)) | ||
| 3518 | return 0; | ||
| 3519 | |||
| 3520 | if (tem = XCDR (prop), CONSP (tem)) | ||
| 3521 | { | ||
| 3522 | it->slice.x = XCAR (tem); | ||
| 3523 | if (tem = XCDR (tem), CONSP (tem)) | ||
| 3524 | { | ||
| 3525 | it->slice.y = XCAR (tem); | ||
| 3526 | if (tem = XCDR (tem), CONSP (tem)) | ||
| 3527 | { | ||
| 3528 | it->slice.width = XCAR (tem); | ||
| 3529 | if (tem = XCDR (tem), CONSP (tem)) | ||
| 3530 | it->slice.height = XCAR (tem); | ||
| 3531 | } | ||
| 3532 | } | ||
| 3533 | } | ||
| 3534 | } | ||
| 3535 | else if (CONSP (prop) | ||
| 3494 | && EQ (XCAR (prop), Qraise) | 3536 | && EQ (XCAR (prop), Qraise) |
| 3495 | && CONSP (XCDR (prop))) | 3537 | && CONSP (XCDR (prop))) |
| 3496 | { | 3538 | { |
| @@ -4331,6 +4373,7 @@ push_it (it) | |||
| 4331 | p->string_nchars = it->string_nchars; | 4373 | p->string_nchars = it->string_nchars; |
| 4332 | p->area = it->area; | 4374 | p->area = it->area; |
| 4333 | p->multibyte_p = it->multibyte_p; | 4375 | p->multibyte_p = it->multibyte_p; |
| 4376 | p->slice = it->slice; | ||
| 4334 | p->space_width = it->space_width; | 4377 | p->space_width = it->space_width; |
| 4335 | p->font_height = it->font_height; | 4378 | p->font_height = it->font_height; |
| 4336 | p->voffset = it->voffset; | 4379 | p->voffset = it->voffset; |
| @@ -4363,6 +4406,7 @@ pop_it (it) | |||
| 4363 | it->string_nchars = p->string_nchars; | 4406 | it->string_nchars = p->string_nchars; |
| 4364 | it->area = p->area; | 4407 | it->area = p->area; |
| 4365 | it->multibyte_p = p->multibyte_p; | 4408 | it->multibyte_p = p->multibyte_p; |
| 4409 | it->slice = p->slice; | ||
| 4366 | it->space_width = p->space_width; | 4410 | it->space_width = p->space_width; |
| 4367 | it->font_height = p->font_height; | 4411 | it->font_height = p->font_height; |
| 4368 | it->voffset = p->voffset; | 4412 | it->voffset = p->voffset; |
| @@ -10762,15 +10806,14 @@ make_cursor_line_fully_visible (w, force_p) | |||
| 10762 | if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) | 10806 | if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) |
| 10763 | return 1; | 10807 | return 1; |
| 10764 | 10808 | ||
| 10765 | if (force_p) | ||
| 10766 | return 0; | ||
| 10767 | |||
| 10768 | /* If the row the cursor is in is taller than the window's height, | 10809 | /* If the row the cursor is in is taller than the window's height, |
| 10769 | it's not clear what to do, so do nothing. */ | 10810 | it's not clear what to do, so do nothing. */ |
| 10770 | window_height = window_box_height (w); | 10811 | window_height = window_box_height (w); |
| 10771 | if (row->height >= window_height) | 10812 | if (row->height >= window_height) |
| 10772 | return 1; | 10813 | { |
| 10773 | 10814 | if (!force_p || w->vscroll) | |
| 10815 | return 1; | ||
| 10816 | } | ||
| 10774 | return 0; | 10817 | return 0; |
| 10775 | 10818 | ||
| 10776 | #if 0 | 10819 | #if 0 |
| @@ -14154,8 +14197,12 @@ append_space (it, default_face_p) | |||
| 14154 | face = FACE_FROM_ID (it->f, it->face_id); | 14197 | face = FACE_FROM_ID (it->f, it->face_id); |
| 14155 | it->face_id = FACE_FOR_CHAR (it->f, face, 0); | 14198 | it->face_id = FACE_FOR_CHAR (it->f, face, 0); |
| 14156 | 14199 | ||
| 14200 | if (it->max_ascent > 0 || it->max_descent > 0) | ||
| 14201 | it->constrain_row_ascent_descent_p = 1; | ||
| 14202 | |||
| 14157 | PRODUCE_GLYPHS (it); | 14203 | PRODUCE_GLYPHS (it); |
| 14158 | 14204 | ||
| 14205 | it->constrain_row_ascent_descent_p = 0; | ||
| 14159 | it->current_x = saved_x; | 14206 | it->current_x = saved_x; |
| 14160 | it->object = saved_object; | 14207 | it->object = saved_object; |
| 14161 | it->position = saved_pos; | 14208 | it->position = saved_pos; |
| @@ -17302,6 +17349,7 @@ fill_image_glyph_string (s) | |||
| 17302 | xassert (s->first_glyph->type == IMAGE_GLYPH); | 17349 | xassert (s->first_glyph->type == IMAGE_GLYPH); |
| 17303 | s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); | 17350 | s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); |
| 17304 | xassert (s->img); | 17351 | xassert (s->img); |
| 17352 | s->slice = s->first_glyph->slice; | ||
| 17305 | s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); | 17353 | s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); |
| 17306 | s->font = s->face->font; | 17354 | s->font = s->face->font; |
| 17307 | s->width = s->first_glyph->pixel_width; | 17355 | s->width = s->first_glyph->pixel_width; |
| @@ -18100,7 +18148,7 @@ take_vertical_position_into_account (it) | |||
| 18100 | if (it->voffset < 0) | 18148 | if (it->voffset < 0) |
| 18101 | /* Increase the ascent so that we can display the text higher | 18149 | /* Increase the ascent so that we can display the text higher |
| 18102 | in the line. */ | 18150 | in the line. */ |
| 18103 | it->ascent += abs (it->voffset); | 18151 | it->ascent -= it->voffset; |
| 18104 | else | 18152 | else |
| 18105 | /* Increase the descent so that we can display the text lower | 18153 | /* Increase the descent so that we can display the text lower |
| 18106 | in the line. */ | 18154 | in the line. */ |
| @@ -18120,6 +18168,7 @@ produce_image_glyph (it) | |||
| 18120 | struct image *img; | 18168 | struct image *img; |
| 18121 | struct face *face; | 18169 | struct face *face; |
| 18122 | int face_ascent, glyph_ascent; | 18170 | int face_ascent, glyph_ascent; |
| 18171 | struct glyph_slice slice; | ||
| 18123 | 18172 | ||
| 18124 | xassert (it->what == IT_IMAGE); | 18173 | xassert (it->what == IT_IMAGE); |
| 18125 | 18174 | ||
| @@ -18143,19 +18192,68 @@ produce_image_glyph (it) | |||
| 18143 | /* Make sure X resources of the image is loaded. */ | 18192 | /* Make sure X resources of the image is loaded. */ |
| 18144 | prepare_image_for_display (it->f, img); | 18193 | prepare_image_for_display (it->f, img); |
| 18145 | 18194 | ||
| 18146 | it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face); | 18195 | slice.x = slice.y = 0; |
| 18147 | it->descent = it->phys_descent = img->height + 2 * img->vmargin - it->ascent; | 18196 | slice.width = img->width; |
| 18148 | it->pixel_width = img->width + 2 * img->hmargin; | 18197 | slice.height = img->height; |
| 18198 | |||
| 18199 | if (INTEGERP (it->slice.x)) | ||
| 18200 | slice.x = XINT (it->slice.x); | ||
| 18201 | else if (FLOATP (it->slice.x)) | ||
| 18202 | slice.x = XFLOAT_DATA (it->slice.x) * img->width; | ||
| 18203 | |||
| 18204 | if (INTEGERP (it->slice.y)) | ||
| 18205 | slice.y = XINT (it->slice.y); | ||
| 18206 | else if (FLOATP (it->slice.y)) | ||
| 18207 | slice.y = XFLOAT_DATA (it->slice.y) * img->height; | ||
| 18208 | |||
| 18209 | if (INTEGERP (it->slice.width)) | ||
| 18210 | slice.width = XINT (it->slice.width); | ||
| 18211 | else if (FLOATP (it->slice.width)) | ||
| 18212 | slice.width = XFLOAT_DATA (it->slice.width) * img->width; | ||
| 18213 | |||
| 18214 | if (INTEGERP (it->slice.height)) | ||
| 18215 | slice.height = XINT (it->slice.height); | ||
| 18216 | else if (FLOATP (it->slice.height)) | ||
| 18217 | slice.height = XFLOAT_DATA (it->slice.height) * img->height; | ||
| 18218 | |||
| 18219 | if (slice.x >= img->width) | ||
| 18220 | slice.x = img->width; | ||
| 18221 | if (slice.y >= img->height) | ||
| 18222 | slice.y = img->height; | ||
| 18223 | if (slice.x + slice.width >= img->width) | ||
| 18224 | slice.width = img->width - slice.x; | ||
| 18225 | if (slice.y + slice.height > img->height) | ||
| 18226 | slice.height = img->height - slice.y; | ||
| 18227 | |||
| 18228 | if (slice.width == 0 || slice.height == 0) | ||
| 18229 | return; | ||
| 18230 | |||
| 18231 | it->ascent = it->phys_ascent = glyph_ascent = image_ascent (img, face, &slice); | ||
| 18232 | |||
| 18233 | it->descent = slice.height - glyph_ascent; | ||
| 18234 | if (slice.y == 0) | ||
| 18235 | it->descent += img->vmargin; | ||
| 18236 | if (slice.y + slice.height == img->height) | ||
| 18237 | it->descent += img->vmargin; | ||
| 18238 | it->phys_descent = it->descent; | ||
| 18239 | |||
| 18240 | it->pixel_width = slice.width; | ||
| 18241 | if (slice.x == 0) | ||
| 18242 | it->pixel_width += img->hmargin; | ||
| 18243 | if (slice.x + slice.width == img->width) | ||
| 18244 | it->pixel_width += img->hmargin; | ||
| 18149 | 18245 | ||
| 18150 | /* It's quite possible for images to have an ascent greater than | 18246 | /* It's quite possible for images to have an ascent greater than |
| 18151 | their height, so don't get confused in that case. */ | 18247 | their height, so don't get confused in that case. */ |
| 18152 | if (it->descent < 0) | 18248 | if (it->descent < 0) |
| 18153 | it->descent = 0; | 18249 | it->descent = 0; |
| 18154 | 18250 | ||
| 18251 | #if 0 /* this breaks image tiling */ | ||
| 18155 | /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */ | 18252 | /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */ |
| 18156 | face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); | 18253 | face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); |
| 18157 | if (face_ascent > it->ascent) | 18254 | if (face_ascent > it->ascent) |
| 18158 | it->ascent = it->phys_ascent = face_ascent; | 18255 | it->ascent = it->phys_ascent = face_ascent; |
| 18256 | #endif | ||
| 18159 | 18257 | ||
| 18160 | it->nglyphs = 1; | 18258 | it->nglyphs = 1; |
| 18161 | 18259 | ||
| @@ -18163,13 +18261,15 @@ produce_image_glyph (it) | |||
| 18163 | { | 18261 | { |
| 18164 | if (face->box_line_width > 0) | 18262 | if (face->box_line_width > 0) |
| 18165 | { | 18263 | { |
| 18166 | it->ascent += face->box_line_width; | 18264 | if (slice.y == 0) |
| 18167 | it->descent += face->box_line_width; | 18265 | it->ascent += face->box_line_width; |
| 18266 | if (slice.y + slice.height == img->height) | ||
| 18267 | it->descent += face->box_line_width; | ||
| 18168 | } | 18268 | } |
| 18169 | 18269 | ||
| 18170 | if (it->start_of_box_run_p) | 18270 | if (it->start_of_box_run_p && slice.x == 0) |
| 18171 | it->pixel_width += abs (face->box_line_width); | 18271 | it->pixel_width += abs (face->box_line_width); |
| 18172 | if (it->end_of_box_run_p) | 18272 | if (it->end_of_box_run_p && slice.x + slice.width == img->width) |
| 18173 | it->pixel_width += abs (face->box_line_width); | 18273 | it->pixel_width += abs (face->box_line_width); |
| 18174 | } | 18274 | } |
| 18175 | 18275 | ||
| @@ -18198,6 +18298,7 @@ produce_image_glyph (it) | |||
| 18198 | glyph->glyph_not_available_p = 0; | 18298 | glyph->glyph_not_available_p = 0; |
| 18199 | glyph->face_id = it->face_id; | 18299 | glyph->face_id = it->face_id; |
| 18200 | glyph->u.img_id = img->id; | 18300 | glyph->u.img_id = img->id; |
| 18301 | glyph->slice = slice; | ||
| 18201 | glyph->font_type = FONT_TYPE_UNKNOWN; | 18302 | glyph->font_type = FONT_TYPE_UNKNOWN; |
| 18202 | ++it->glyph_row->used[area]; | 18303 | ++it->glyph_row->used[area]; |
| 18203 | } | 18304 | } |
| @@ -18491,6 +18592,7 @@ x_produce_glyphs (it) | |||
| 18491 | 18592 | ||
| 18492 | pcm = rif->per_char_metric (font, &char2b, | 18593 | pcm = rif->per_char_metric (font, &char2b, |
| 18493 | FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display)); | 18594 | FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display)); |
| 18595 | |||
| 18494 | it->ascent = FONT_BASE (font) + boff; | 18596 | it->ascent = FONT_BASE (font) + boff; |
| 18495 | it->descent = FONT_DESCENT (font) - boff; | 18597 | it->descent = FONT_DESCENT (font) - boff; |
| 18496 | 18598 | ||
| @@ -18503,11 +18605,27 @@ x_produce_glyphs (it) | |||
| 18503 | else | 18605 | else |
| 18504 | { | 18606 | { |
| 18505 | it->glyph_not_available_p = 1; | 18607 | it->glyph_not_available_p = 1; |
| 18506 | it->phys_ascent = FONT_BASE (font) + boff; | 18608 | it->phys_ascent = it->ascent; |
| 18507 | it->phys_descent = FONT_DESCENT (font) - boff; | 18609 | it->phys_descent = it->descent; |
| 18508 | it->pixel_width = FONT_WIDTH (font); | 18610 | it->pixel_width = FONT_WIDTH (font); |
| 18509 | } | 18611 | } |
| 18510 | 18612 | ||
| 18613 | if (it->constrain_row_ascent_descent_p) | ||
| 18614 | { | ||
| 18615 | if (it->descent > it->max_descent) | ||
| 18616 | { | ||
| 18617 | it->ascent += it->descent - it->max_descent; | ||
| 18618 | it->descent = it->max_descent; | ||
| 18619 | } | ||
| 18620 | if (it->ascent> it->max_ascent) | ||
| 18621 | { | ||
| 18622 | it->descent = min (it->max_descent, it->descent + it->ascent - it->max_ascent); | ||
| 18623 | it->ascent = it->max_ascent; | ||
| 18624 | } | ||
| 18625 | it->phys_ascent = min (it->phys_ascent, it->ascent); | ||
| 18626 | it->phys_descent = min (it->phys_descent, it->descent); | ||
| 18627 | } | ||
| 18628 | |||
| 18511 | /* If this is a space inside a region of text with | 18629 | /* If this is a space inside a region of text with |
| 18512 | `space-width' property, change its width. */ | 18630 | `space-width' property, change its width. */ |
| 18513 | stretched_p = it->char_to_display == ' ' && !NILP (it->space_width); | 18631 | stretched_p = it->char_to_display == ' ' && !NILP (it->space_width); |
| @@ -18540,6 +18658,14 @@ x_produce_glyphs (it) | |||
| 18540 | if (face->overline_p) | 18658 | if (face->overline_p) |
| 18541 | it->ascent += 2; | 18659 | it->ascent += 2; |
| 18542 | 18660 | ||
| 18661 | if (it->constrain_row_ascent_descent_p) | ||
| 18662 | { | ||
| 18663 | if (it->ascent > it->max_ascent) | ||
| 18664 | it->ascent = it->max_ascent; | ||
| 18665 | if (it->descent > it->max_descent) | ||
| 18666 | it->descent = it->max_descent; | ||
| 18667 | } | ||
| 18668 | |||
| 18543 | take_vertical_position_into_account (it); | 18669 | take_vertical_position_into_account (it); |
| 18544 | 18670 | ||
| 18545 | /* If we have to actually produce glyphs, do it. */ | 18671 | /* If we have to actually produce glyphs, do it. */ |
| @@ -18566,13 +18692,31 @@ x_produce_glyphs (it) | |||
| 18566 | } | 18692 | } |
| 18567 | else if (it->char_to_display == '\n') | 18693 | else if (it->char_to_display == '\n') |
| 18568 | { | 18694 | { |
| 18569 | /* A newline has no width but we need the height of the line. */ | 18695 | /* A newline has no width but we need the height of the line. |
| 18696 | But if previous part of the line set a height, don't | ||
| 18697 | increase that height */ | ||
| 18698 | |||
| 18570 | it->pixel_width = 0; | 18699 | it->pixel_width = 0; |
| 18571 | it->nglyphs = 0; | 18700 | it->nglyphs = 0; |
| 18572 | it->ascent = it->phys_ascent = FONT_BASE (font) + boff; | ||
| 18573 | it->descent = it->phys_descent = FONT_DESCENT (font) - boff; | ||
| 18574 | 18701 | ||
| 18575 | if (face->box != FACE_NO_BOX | 18702 | it->ascent = FONT_BASE (font) + boff; |
| 18703 | it->descent = FONT_DESCENT (font) - boff; | ||
| 18704 | |||
| 18705 | if (it->max_ascent > 0 || it->max_descent > 0) | ||
| 18706 | { | ||
| 18707 | it->ascent = it->descent = 0; | ||
| 18708 | } | ||
| 18709 | else | ||
| 18710 | { | ||
| 18711 | it->ascent = FONT_BASE (font) + boff; | ||
| 18712 | it->descent = FONT_DESCENT (font) - boff; | ||
| 18713 | } | ||
| 18714 | |||
| 18715 | it->phys_ascent = it->ascent; | ||
| 18716 | it->phys_descent = it->descent; | ||
| 18717 | |||
| 18718 | if ((it->max_ascent > 0 || it->max_descent > 0) | ||
| 18719 | && face->box != FACE_NO_BOX | ||
| 18576 | && face->box_line_width > 0) | 18720 | && face->box_line_width > 0) |
| 18577 | { | 18721 | { |
| 18578 | it->ascent += face->box_line_width; | 18722 | it->ascent += face->box_line_width; |
| @@ -20547,7 +20691,9 @@ note_mouse_highlight (f, x, y) | |||
| 20547 | Lisp_Object image_map, hotspot; | 20691 | Lisp_Object image_map, hotspot; |
| 20548 | if ((image_map = Fplist_get (XCDR (img->spec), QCmap), | 20692 | if ((image_map = Fplist_get (XCDR (img->spec), QCmap), |
| 20549 | !NILP (image_map)) | 20693 | !NILP (image_map)) |
| 20550 | && (hotspot = find_hot_spot (image_map, dx, dy), | 20694 | && (hotspot = find_hot_spot (image_map, |
| 20695 | glyph->slice.x + dx, | ||
| 20696 | glyph->slice.y + dy), | ||
| 20551 | CONSP (hotspot)) | 20697 | CONSP (hotspot)) |
| 20552 | && (hotspot = XCDR (hotspot), CONSP (hotspot))) | 20698 | && (hotspot = XCDR (hotspot), CONSP (hotspot))) |
| 20553 | { | 20699 | { |
| @@ -21584,6 +21730,8 @@ syms_of_xdisp () | |||
| 21584 | staticpro (&Qspace_width); | 21730 | staticpro (&Qspace_width); |
| 21585 | Qraise = intern ("raise"); | 21731 | Qraise = intern ("raise"); |
| 21586 | staticpro (&Qraise); | 21732 | staticpro (&Qraise); |
| 21733 | Qslice = intern ("slice"); | ||
| 21734 | staticpro (&Qslice); | ||
| 21587 | Qspace = intern ("space"); | 21735 | Qspace = intern ("space"); |
| 21588 | staticpro (&Qspace); | 21736 | staticpro (&Qspace); |
| 21589 | Qmargin = intern ("margin"); | 21737 | Qmargin = intern ("margin"); |