comparison src/xdisp.c @ 83116:6ae3d2810507

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-262 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264 Update from CVS: lispref/display.texi: emacs -> Emacs. * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-266 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-267 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-156
author Karoly Lorentey <lorentey@elte.hu>
date Sat, 01 May 2004 19:23:22 +0000
parents 141388e31bb7 c5bad07bbb95
children 46882e012e30
comparison
equal deleted inserted replaced
83115:141388e31bb7 83116:6ae3d2810507
2067 if (base_face_id == DEFAULT_FACE_ID 2067 if (base_face_id == DEFAULT_FACE_ID
2068 && FRAME_WINDOW_P (it->f)) 2068 && FRAME_WINDOW_P (it->f))
2069 { 2069 {
2070 if (NATNUMP (current_buffer->extra_line_spacing)) 2070 if (NATNUMP (current_buffer->extra_line_spacing))
2071 it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing); 2071 it->extra_line_spacing = XFASTINT (current_buffer->extra_line_spacing);
2072 else if (FLOATP (current_buffer->extra_line_spacing))
2073 it->extra_line_spacing = (XFLOAT_DATA (current_buffer->extra_line_spacing)
2074 * FRAME_LINE_HEIGHT (it->f));
2072 else if (it->f->extra_line_spacing > 0) 2075 else if (it->f->extra_line_spacing > 0)
2073 it->extra_line_spacing = it->f->extra_line_spacing; 2076 it->extra_line_spacing = it->f->extra_line_spacing;
2074 } 2077 }
2075 2078
2076 /* If realized faces have been removed, e.g. because of face 2079 /* If realized faces have been removed, e.g. because of face
2084 2087
2085 /* Current value of the `slice', `space-width', and 'height' properties. */ 2088 /* Current value of the `slice', `space-width', and 'height' properties. */
2086 it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil; 2089 it->slice.x = it->slice.y = it->slice.width = it->slice.height = Qnil;
2087 it->space_width = Qnil; 2090 it->space_width = Qnil;
2088 it->font_height = Qnil; 2091 it->font_height = Qnil;
2092 it->override_ascent = -1;
2089 2093
2090 /* Are control characters displayed as `^C'? */ 2094 /* Are control characters displayed as `^C'? */
2091 it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow); 2095 it->ctl_arrow_p = !NILP (current_buffer->ctl_arrow);
2092 2096
2093 /* -1 means everything between a CR and the following line end 2097 /* -1 means everything between a CR and the following line end
14199 face = FACE_FROM_ID (it->f, it->face_id); 14203 face = FACE_FROM_ID (it->f, it->face_id);
14200 it->face_id = FACE_FOR_CHAR (it->f, face, 0); 14204 it->face_id = FACE_FOR_CHAR (it->f, face, 0);
14201 14205
14202 PRODUCE_GLYPHS (it); 14206 PRODUCE_GLYPHS (it);
14203 14207
14204 it->use_default_face = 0; 14208 it->override_ascent = -1;
14205 it->constrain_row_ascent_descent_p = 0; 14209 it->constrain_row_ascent_descent_p = 0;
14206 it->current_x = saved_x; 14210 it->current_x = saved_x;
14207 it->object = saved_object; 14211 it->object = saved_object;
14208 it->position = saved_pos; 14212 it->position = saved_pos;
14209 it->what = saved_what; 14213 it->what = saved_what;
18507 } 18511 }
18508 18512
18509 take_vertical_position_into_account (it); 18513 take_vertical_position_into_account (it);
18510 } 18514 }
18511 18515
18516 /* Calculate line-height and line-spacing properties.
18517 An integer value specifies explicit pixel value.
18518 A float value specifies relative value to current face height.
18519 A cons (float . face-name) specifies relative value to
18520 height of specified face font.
18521
18522 Returns height in pixels, or nil. */
18523
18524 static Lisp_Object
18525 calc_line_height_property (it, prop, font, boff)
18526 struct it *it;
18527 Lisp_Object prop;
18528 XFontStruct *font;
18529 int boff;
18530 {
18531 Lisp_Object val;
18532 Lisp_Object face_name = Qnil;
18533 int ascent, descent, height, override;
18534
18535 val = Fget_char_property (make_number (IT_CHARPOS (*it)),
18536 prop, it->object);
18537
18538 if (NILP (val))
18539 return val;
18540
18541 if (INTEGERP (val))
18542 return val;
18543
18544 if (CONSP (val))
18545 {
18546 face_name = XCDR (val);
18547 val = XCAR (val);
18548 }
18549 else if (SYMBOLP (val))
18550 {
18551 face_name = val;
18552 val = Qnil;
18553 }
18554
18555 override = EQ (prop, Qline_height);
18556
18557 if (NILP (face_name))
18558 {
18559 font = FRAME_FONT (it->f);
18560 boff = FRAME_BASELINE_OFFSET (it->f);
18561 }
18562 else if (EQ (face_name, Qt))
18563 {
18564 override = 0;
18565 }
18566 else
18567 {
18568 int face_id;
18569 struct face *face;
18570 struct font_info *font_info;
18571
18572 face_id = lookup_named_face (it->f, face_name, ' ');
18573 if (face_id < 0)
18574 return -1;
18575
18576 face = FACE_FROM_ID (it->f, face_id);
18577 font = face->font;
18578 if (font == NULL)
18579 return -1;
18580
18581 font_info = FONT_INFO_FROM_ID (it->f, face->font_info_id);
18582 boff = font_info->baseline_offset;
18583 if (font_info->vertical_centering)
18584 boff = VCENTER_BASELINE_OFFSET (font, it->f) - boff;
18585 }
18586
18587 ascent = FONT_BASE (font) + boff;
18588 descent = FONT_DESCENT (font) - boff;
18589
18590 if (override)
18591 {
18592 it->override_ascent = ascent;
18593 it->override_descent = descent;
18594 it->override_boff = boff;
18595 }
18596
18597 height = ascent + descent;
18598 if (FLOATP (val))
18599 height = (int)(XFLOAT_DATA (val) * height);
18600 else if (INTEGERP (val))
18601 height *= XINT (val);
18602
18603 return make_number (height);
18604 }
18605
18606
18512 /* RIF: 18607 /* RIF:
18513 Produce glyphs/get display metrics for the display element IT is 18608 Produce glyphs/get display metrics for the display element IT is
18514 loaded with. See the description of struct display_iterator in 18609 loaded with. See the description of struct display_iterator in
18515 dispextern.h for an overview of struct display_iterator. */ 18610 dispextern.h for an overview of struct display_iterator. */
18516 18611
18593 /* Either unibyte or ASCII. */ 18688 /* Either unibyte or ASCII. */
18594 int stretched_p; 18689 int stretched_p;
18595 18690
18596 it->nglyphs = 1; 18691 it->nglyphs = 1;
18597 18692
18598 if (it->use_default_face) 18693 pcm = FRAME_RIF (it->f)->per_char_metric
18694 (font, &char2b, FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display));
18695
18696 if (it->override_ascent >= 0)
18599 { 18697 {
18600 font = FRAME_FONT (it->f); 18698 it->ascent = it->override_ascent;
18601 boff = FRAME_BASELINE_OFFSET (it->f); 18699 it->descent = it->override_descent;
18700 boff = it->override_boff;
18602 } 18701 }
18603 18702 else
18604 pcm = FRAME_RIF (it->f)->per_char_metric 18703 {
18605 (font, &char2b, FONT_TYPE_FOR_UNIBYTE (font, it->char_to_display)); 18704 it->ascent = FONT_BASE (font) + boff;
18606 18705 it->descent = FONT_DESCENT (font) - boff;
18607 it->ascent = FONT_BASE (font) + boff; 18706 }
18608 it->descent = FONT_DESCENT (font) - boff;
18609 18707
18610 if (pcm) 18708 if (pcm)
18611 { 18709 {
18612 it->phys_ascent = pcm->ascent + boff; 18710 it->phys_ascent = pcm->ascent + boff;
18613 it->phys_descent = pcm->descent - boff; 18711 it->phys_descent = pcm->descent - boff;
18706 { 18804 {
18707 /* A newline has no width but we need the height of the line. 18805 /* A newline has no width but we need the height of the line.
18708 But if previous part of the line set a height, don't 18806 But if previous part of the line set a height, don't
18709 increase that height */ 18807 increase that height */
18710 18808
18711 Lisp_Object lsp, lh; 18809 Lisp_Object height, spacing;
18712 18810
18811 it->override_ascent = -1;
18713 it->pixel_width = 0; 18812 it->pixel_width = 0;
18714 it->nglyphs = 0; 18813 it->nglyphs = 0;
18715 18814
18716 lh = Fget_text_property (make_number (IT_CHARPOS (*it)), 18815 height = calc_line_height_property(it, Qline_height, font, boff);
18717 Qline_height, it->object); 18816
18718 18817 if (it->override_ascent >= 0)
18719 if (EQ (lh, Qt))
18720 { 18818 {
18721 it->use_default_face = 1; 18819 it->ascent = it->override_ascent;
18722 font = FRAME_FONT (it->f); 18820 it->descent = it->override_descent;
18723 boff = FRAME_BASELINE_OFFSET (it->f); 18821 boff = it->override_boff;
18724 font_info = NULL;
18725 } 18822 }
18726 18823 else
18727 it->ascent = FONT_BASE (font) + boff; 18824 {
18728 it->descent = FONT_DESCENT (font) - boff; 18825 it->ascent = FONT_BASE (font) + boff;
18729 18826 it->descent = FONT_DESCENT (font) - boff;
18730 if (EQ (lh, make_number (0))) 18827 }
18828
18829 if (EQ (height, make_number(0)))
18731 { 18830 {
18732 if (it->descent > it->max_descent) 18831 if (it->descent > it->max_descent)
18733 { 18832 {
18734 it->ascent += it->descent - it->max_descent; 18833 it->ascent += it->descent - it->max_descent;
18735 it->descent = it->max_descent; 18834 it->descent = it->max_descent;
18744 it->constrain_row_ascent_descent_p = 1; 18843 it->constrain_row_ascent_descent_p = 1;
18745 extra_line_spacing = 0; 18844 extra_line_spacing = 0;
18746 } 18845 }
18747 else 18846 else
18748 { 18847 {
18749 int explicit_height = -1;
18750 it->phys_ascent = it->ascent; 18848 it->phys_ascent = it->ascent;
18751 it->phys_descent = it->descent; 18849 it->phys_descent = it->descent;
18752 18850
18753 if ((it->max_ascent > 0 || it->max_descent > 0) 18851 if ((it->max_ascent > 0 || it->max_descent > 0)
18754 && face->box != FACE_NO_BOX 18852 && face->box != FACE_NO_BOX
18755 && face->box_line_width > 0) 18853 && face->box_line_width > 0)
18756 { 18854 {
18757 it->ascent += face->box_line_width; 18855 it->ascent += face->box_line_width;
18758 it->descent += face->box_line_width; 18856 it->descent += face->box_line_width;
18759 } 18857 }
18760 if (INTEGERP (lh)) 18858 if (!NILP (height)
18761 explicit_height = XINT (lh); 18859 && XINT (height) > it->ascent + it->descent)
18762 else if (FLOATP (lh)) 18860 it->ascent = XINT (height) - it->descent;
18763 explicit_height = (it->phys_ascent + it->phys_descent)
18764 * XFLOAT_DATA (lh);
18765
18766 if (explicit_height > it->ascent + it->descent)
18767 it->ascent = explicit_height - it->descent;
18768 } 18861 }
18769 18862
18770 lsp = Fget_text_property (make_number (IT_CHARPOS (*it)), 18863 spacing = calc_line_height_property(it, Qline_spacing, font, boff);
18771 Qline_spacing, it->object); 18864 if (!NILP (spacing))
18772 if (INTEGERP (lsp)) 18865 {
18773 extra_line_spacing = XINT (lsp); 18866 int sp = XINT (spacing);
18774 else if (FLOATP (lsp)) 18867 if (sp < 0)
18775 extra_line_spacing = (it->phys_ascent + it->phys_descent) 18868 extra_line_spacing = (-sp) - (it->phys_ascent + it->phys_descent);
18776 * XFLOAT_DATA (lsp); 18869 else
18870 extra_line_spacing = sp;
18871 }
18777 } 18872 }
18778 else if (it->char_to_display == '\t') 18873 else if (it->char_to_display == '\t')
18779 { 18874 {
18780 int tab_width = it->tab_width * FRAME_COLUMN_WIDTH (it->f); 18875 int tab_width = it->tab_width * FRAME_COLUMN_WIDTH (it->f);
18781 int x = it->current_x + it->continuation_lines_width; 18876 int x = it->current_x + it->continuation_lines_width;
19148 because this isn't true for images with `:ascent 100'. */ 19243 because this isn't true for images with `:ascent 100'. */
19149 xassert (it->ascent >= 0 && it->descent >= 0); 19244 xassert (it->ascent >= 0 && it->descent >= 0);
19150 if (it->area == TEXT_AREA) 19245 if (it->area == TEXT_AREA)
19151 it->current_x += it->pixel_width; 19246 it->current_x += it->pixel_width;
19152 19247
19153 it->descent += extra_line_spacing; 19248 if (extra_line_spacing > 0)
19249 it->descent += extra_line_spacing;
19154 19250
19155 it->max_ascent = max (it->max_ascent, it->ascent); 19251 it->max_ascent = max (it->max_ascent, it->ascent);
19156 it->max_descent = max (it->max_descent, it->descent); 19252 it->max_descent = max (it->max_descent, it->descent);
19157 it->max_phys_ascent = max (it->max_phys_ascent, it->phys_ascent); 19253 it->max_phys_ascent = max (it->max_phys_ascent, it->phys_ascent);
19158 it->max_phys_descent = max (it->max_phys_descent, it->phys_descent); 19254 it->max_phys_descent = max (it->max_phys_descent, it->phys_descent);
20811 position = make_number (pos); 20907 position = make_number (pos);
20812 20908
20813 if (BUFFERP (object)) 20909 if (BUFFERP (object))
20814 { 20910 {
20815 /* Put all the overlays we want in a vector in overlay_vec. 20911 /* Put all the overlays we want in a vector in overlay_vec.
20816 Store the length in len. If there are more than 10, make 20912 Store the length in len. If there are more than 40, make
20817 enough space for all, and try again. */ 20913 enough space for all, and try again. */
20818 len = 10; 20914 len = 40;
20819 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); 20915 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
20820 noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0); 20916 noverlays = overlays_at (pos, 0, &overlay_vec, &len, NULL, NULL, 0);
20821 if (noverlays > len) 20917 if (noverlays > len)
20822 { 20918 {
20823 len = noverlays; 20919 len = noverlays;