diff options
| author | Kim F. Storm | 2004-05-04 12:51:45 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-05-04 12:51:45 +0000 |
| commit | 17b01ffc9689600ae45e5667365cd4f6a59b4959 (patch) | |
| tree | 680d180c517b4010be1e8acc4e68d7ca979e1e1a /src | |
| parent | 0498520b279d579fe9e125f99e0bbc93f2f802f7 (diff) | |
| download | emacs-17b01ffc9689600ae45e5667365cd4f6a59b4959.tar.gz emacs-17b01ffc9689600ae45e5667365cd4f6a59b4959.zip | |
(Qtotal): New var.
(syms_of_xdisp): Intern and staticpro it.
(calc_line_height_property): New arg total. Set it if
line-spacing property has format (total . VALUE).
(x_produce_glyphs): Ignore line-spacing if line-height is 0.
Handle total line-spacing property.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index 8ccd08ebae7..da5f6df7dc8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -304,7 +304,7 @@ Lisp_Object Qleft_margin, Qright_margin, Qspace_width, Qraise; | |||
| 304 | Lisp_Object Qslice; | 304 | Lisp_Object Qslice; |
| 305 | Lisp_Object Qcenter; | 305 | Lisp_Object Qcenter; |
| 306 | Lisp_Object Qmargin, Qpointer; | 306 | Lisp_Object Qmargin, Qpointer; |
| 307 | Lisp_Object Qline_height; | 307 | Lisp_Object Qline_height, Qtotal; |
| 308 | extern Lisp_Object Qheight; | 308 | extern Lisp_Object Qheight; |
| 309 | extern Lisp_Object QCwidth, QCheight, QCascent; | 309 | extern Lisp_Object QCwidth, QCheight, QCascent; |
| 310 | extern Lisp_Object Qscroll_bar; | 310 | extern Lisp_Object Qscroll_bar; |
| @@ -18523,11 +18523,11 @@ produce_stretch_glyph (it) | |||
| 18523 | Returns height in pixels, or nil. */ | 18523 | Returns height in pixels, or nil. */ |
| 18524 | 18524 | ||
| 18525 | static Lisp_Object | 18525 | static Lisp_Object |
| 18526 | calc_line_height_property (it, prop, font, boff) | 18526 | calc_line_height_property (it, prop, font, boff, total) |
| 18527 | struct it *it; | 18527 | struct it *it; |
| 18528 | Lisp_Object prop; | 18528 | Lisp_Object prop; |
| 18529 | XFontStruct *font; | 18529 | XFontStruct *font; |
| 18530 | int boff; | 18530 | int boff, *total; |
| 18531 | { | 18531 | { |
| 18532 | Lisp_Object val; | 18532 | Lisp_Object val; |
| 18533 | Lisp_Object face_name = Qnil; | 18533 | Lisp_Object face_name = Qnil; |
| @@ -18539,6 +18539,12 @@ calc_line_height_property (it, prop, font, boff) | |||
| 18539 | if (NILP (val)) | 18539 | if (NILP (val)) |
| 18540 | return val; | 18540 | return val; |
| 18541 | 18541 | ||
| 18542 | if (total && CONSP (val) && EQ (XCAR (val), Qtotal)) | ||
| 18543 | { | ||
| 18544 | *total = 1; | ||
| 18545 | val = XCDR (val); | ||
| 18546 | } | ||
| 18547 | |||
| 18542 | if (INTEGERP (val)) | 18548 | if (INTEGERP (val)) |
| 18543 | return val; | 18549 | return val; |
| 18544 | 18550 | ||
| @@ -18807,13 +18813,13 @@ x_produce_glyphs (it) | |||
| 18807 | But if previous part of the line set a height, don't | 18813 | But if previous part of the line set a height, don't |
| 18808 | increase that height */ | 18814 | increase that height */ |
| 18809 | 18815 | ||
| 18810 | Lisp_Object height, spacing; | 18816 | Lisp_Object height; |
| 18811 | 18817 | ||
| 18812 | it->override_ascent = -1; | 18818 | it->override_ascent = -1; |
| 18813 | it->pixel_width = 0; | 18819 | it->pixel_width = 0; |
| 18814 | it->nglyphs = 0; | 18820 | it->nglyphs = 0; |
| 18815 | 18821 | ||
| 18816 | height = calc_line_height_property(it, Qline_height, font, boff); | 18822 | height = calc_line_height_property(it, Qline_height, font, boff, 0); |
| 18817 | 18823 | ||
| 18818 | if (it->override_ascent >= 0) | 18824 | if (it->override_ascent >= 0) |
| 18819 | { | 18825 | { |
| @@ -18846,6 +18852,9 @@ x_produce_glyphs (it) | |||
| 18846 | } | 18852 | } |
| 18847 | else | 18853 | else |
| 18848 | { | 18854 | { |
| 18855 | Lisp_Object spacing; | ||
| 18856 | int total = 0; | ||
| 18857 | |||
| 18849 | it->phys_ascent = it->ascent; | 18858 | it->phys_ascent = it->ascent; |
| 18850 | it->phys_descent = it->descent; | 18859 | it->phys_descent = it->descent; |
| 18851 | 18860 | ||
| @@ -18859,16 +18868,14 @@ x_produce_glyphs (it) | |||
| 18859 | if (!NILP (height) | 18868 | if (!NILP (height) |
| 18860 | && XINT (height) > it->ascent + it->descent) | 18869 | && XINT (height) > it->ascent + it->descent) |
| 18861 | it->ascent = XINT (height) - it->descent; | 18870 | it->ascent = XINT (height) - it->descent; |
| 18862 | } | ||
| 18863 | 18871 | ||
| 18864 | spacing = calc_line_height_property(it, Qline_spacing, font, boff); | 18872 | spacing = calc_line_height_property(it, Qline_spacing, font, boff, &total); |
| 18865 | if (!NILP (spacing)) | 18873 | if (INTEGERP (spacing)) |
| 18866 | { | 18874 | { |
| 18867 | int sp = XINT (spacing); | 18875 | extra_line_spacing = XINT (spacing); |
| 18868 | if (sp < 0) | 18876 | if (total) |
| 18869 | extra_line_spacing = (-sp) - (it->phys_ascent + it->phys_descent); | 18877 | extra_line_spacing -= (it->phys_ascent + it->phys_descent); |
| 18870 | else | 18878 | } |
| 18871 | extra_line_spacing = sp; | ||
| 18872 | } | 18879 | } |
| 18873 | } | 18880 | } |
| 18874 | else if (it->char_to_display == '\t') | 18881 | else if (it->char_to_display == '\t') |
| @@ -21894,6 +21901,8 @@ syms_of_xdisp () | |||
| 21894 | staticpro (&Qcenter); | 21901 | staticpro (&Qcenter); |
| 21895 | Qline_height = intern ("line-height"); | 21902 | Qline_height = intern ("line-height"); |
| 21896 | staticpro (&Qline_height); | 21903 | staticpro (&Qline_height); |
| 21904 | Qtotal = intern ("total"); | ||
| 21905 | staticpro (&Qtotal); | ||
| 21897 | QCalign_to = intern (":align-to"); | 21906 | QCalign_to = intern (":align-to"); |
| 21898 | staticpro (&QCalign_to); | 21907 | staticpro (&QCalign_to); |
| 21899 | QCrelative_width = intern (":relative-width"); | 21908 | QCrelative_width = intern (":relative-width"); |