aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2001-02-09 12:33:58 +0000
committerKenichi Handa2001-02-09 12:33:58 +0000
commitea2ba0d40e29d757a8a4acbbd3e8e8e5774ade27 (patch)
tree99a43bb5826cb57f9948d421ff7812488ae936b7 /src
parentc8d9b4eead837ea87832c5cff0bf371f31d331b1 (diff)
downloademacs-ea2ba0d40e29d757a8a4acbbd3e8e8e5774ade27.tar.gz
emacs-ea2ba0d40e29d757a8a4acbbd3e8e8e5774ade27.zip
(x_produce_image_glyph): Pay attention to the case that
face->box_line_width is negative. (x_produce_stretch_glyph): Likewise. (x_produce_glyphs): Likewise. (x_estimate_mode_line_height): Likewise. (x_draw_glyph_string_background): Likewise. (x_draw_glyph_string_foreground): Likewise. (x_draw_composite_glyph_string_foreground): Likewise. (x_draw_glyph_string_box): Likewise. (x_draw_image_foreground): Likewise. (x_draw_image_relief): Likewise. (x_draw_image_foreground_1): Likewise. (x_draw_image_glyph_string): Likewise.
Diffstat (limited to 'src')
-rw-r--r--src/xterm.c99
1 files changed, 63 insertions, 36 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 14a34bd2eca..a20acf026d4 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1516,13 +1516,16 @@ x_produce_image_glyph (it)
1516 1516
1517 if (face->box != FACE_NO_BOX) 1517 if (face->box != FACE_NO_BOX)
1518 { 1518 {
1519 it->ascent += face->box_line_width; 1519 if (face->box_line_width > 0)
1520 it->descent += face->box_line_width; 1520 {
1521 it->ascent += face->box_line_width;
1522 it->descent += face->box_line_width;
1523 }
1521 1524
1522 if (it->start_of_box_run_p) 1525 if (it->start_of_box_run_p)
1523 it->pixel_width += face->box_line_width; 1526 it->pixel_width += abs (face->box_line_width);
1524 if (it->end_of_box_run_p) 1527 if (it->end_of_box_run_p)
1525 it->pixel_width += face->box_line_width; 1528 it->pixel_width += abs (face->box_line_width);
1526 } 1529 }
1527 1530
1528 take_vertical_position_into_account (it); 1531 take_vertical_position_into_account (it);
@@ -1727,13 +1730,16 @@ x_produce_stretch_glyph (it)
1727 1730
1728 if (face->box != FACE_NO_BOX) 1731 if (face->box != FACE_NO_BOX)
1729 { 1732 {
1730 it->ascent += face->box_line_width; 1733 if (face->box_line_width > 0)
1731 it->descent += face->box_line_width; 1734 {
1735 it->ascent += face->box_line_width;
1736 it->descent += face->box_line_width;
1737 }
1732 1738
1733 if (it->start_of_box_run_p) 1739 if (it->start_of_box_run_p)
1734 it->pixel_width += face->box_line_width; 1740 it->pixel_width += abs (face->box_line_width);
1735 if (it->end_of_box_run_p) 1741 if (it->end_of_box_run_p)
1736 it->pixel_width += face->box_line_width; 1742 it->pixel_width += abs (face->box_line_width);
1737 } 1743 }
1738 1744
1739 take_vertical_position_into_account (it); 1745 take_vertical_position_into_account (it);
@@ -1890,9 +1896,14 @@ x_produce_glyphs (it)
1890 { 1896 {
1891 int thick = face->box_line_width; 1897 int thick = face->box_line_width;
1892 1898
1893 it->ascent += thick; 1899 if (thick > 0)
1894 it->descent += thick; 1900 {
1895 1901 it->ascent += thick;
1902 it->descent += thick;
1903 }
1904 else
1905 thick = -thick;
1906
1896 if (it->start_of_box_run_p) 1907 if (it->start_of_box_run_p)
1897 it->pixel_width += thick; 1908 it->pixel_width += thick;
1898 if (it->end_of_box_run_p) 1909 if (it->end_of_box_run_p)
@@ -1935,11 +1946,11 @@ x_produce_glyphs (it)
1935 it->ascent = it->phys_ascent = font->ascent + boff; 1946 it->ascent = it->phys_ascent = font->ascent + boff;
1936 it->descent = it->phys_descent = font->descent - boff; 1947 it->descent = it->phys_descent = font->descent - boff;
1937 1948
1938 if (face->box != FACE_NO_BOX) 1949 if (face->box != FACE_NO_BOX
1950 && face->box_line_width > 0)
1939 { 1951 {
1940 int thick = face->box_line_width; 1952 it->ascent += face->box_line_width;
1941 it->ascent += thick; 1953 it->descent += face->box_line_width;
1942 it->descent += thick;
1943 } 1954 }
1944 } 1955 }
1945 else if (it->char_to_display == '\t') 1956 else if (it->char_to_display == '\t')
@@ -2004,8 +2015,14 @@ x_produce_glyphs (it)
2004 if (face->box != FACE_NO_BOX) 2015 if (face->box != FACE_NO_BOX)
2005 { 2016 {
2006 int thick = face->box_line_width; 2017 int thick = face->box_line_width;
2007 it->ascent += thick; 2018
2008 it->descent += thick; 2019 if (thick > 0)
2020 {
2021 it->ascent += thick;
2022 it->descent += thick;
2023 }
2024 else
2025 thick = - thick;
2009 2026
2010 if (it->start_of_box_run_p) 2027 if (it->start_of_box_run_p)
2011 it->pixel_width += thick; 2028 it->pixel_width += thick;
@@ -2271,8 +2288,14 @@ x_produce_glyphs (it)
2271 if (face->box != FACE_NO_BOX) 2288 if (face->box != FACE_NO_BOX)
2272 { 2289 {
2273 int thick = face->box_line_width; 2290 int thick = face->box_line_width;
2274 it->ascent += thick; 2291
2275 it->descent += thick; 2292 if (thick > 0)
2293 {
2294 it->ascent += thick;
2295 it->descent += thick;
2296 }
2297 else
2298 thick = - thick;
2276 2299
2277 if (it->start_of_box_run_p) 2300 if (it->start_of_box_run_p)
2278 it->pixel_width += thick; 2301 it->pixel_width += thick;
@@ -2329,7 +2352,8 @@ x_estimate_mode_line_height (f, face_id)
2329 { 2352 {
2330 if (face->font) 2353 if (face->font)
2331 height = FONT_HEIGHT (face->font); 2354 height = FONT_HEIGHT (face->font);
2332 height += 2 * face->box_line_width; 2355 if (face->box_line_width > 0)
2356 height += 2 * face->box_line_width;
2333 } 2357 }
2334 } 2358 }
2335 2359
@@ -3076,25 +3100,27 @@ x_draw_glyph_string_background (s, force_p)
3076 shouldn't be drawn in the first place. */ 3100 shouldn't be drawn in the first place. */
3077 if (!s->background_filled_p) 3101 if (!s->background_filled_p)
3078 { 3102 {
3103 int box_line_width = max (s->face->box_line_width, 0);
3104
3079 if (s->stippled_p) 3105 if (s->stippled_p)
3080 { 3106 {
3081 /* Fill background with a stipple pattern. */ 3107 /* Fill background with a stipple pattern. */
3082 XSetFillStyle (s->display, s->gc, FillOpaqueStippled); 3108 XSetFillStyle (s->display, s->gc, FillOpaqueStippled);
3083 XFillRectangle (s->display, s->window, s->gc, s->x, 3109 XFillRectangle (s->display, s->window, s->gc, s->x,
3084 s->y + s->face->box_line_width, 3110 s->y + box_line_width,
3085 s->background_width, 3111 s->background_width,
3086 s->height - 2 * s->face->box_line_width); 3112 s->height - 2 * box_line_width);
3087 XSetFillStyle (s->display, s->gc, FillSolid); 3113 XSetFillStyle (s->display, s->gc, FillSolid);
3088 s->background_filled_p = 1; 3114 s->background_filled_p = 1;
3089 } 3115 }
3090 else if (FONT_HEIGHT (s->font) < s->height - 2 * s->face->box_line_width 3116 else if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
3091 || s->font_not_found_p 3117 || s->font_not_found_p
3092 || s->extends_to_end_of_line_p 3118 || s->extends_to_end_of_line_p
3093 || force_p) 3119 || force_p)
3094 { 3120 {
3095 x_clear_glyph_string_rect (s, s->x, s->y + s->face->box_line_width, 3121 x_clear_glyph_string_rect (s, s->x, s->y + box_line_width,
3096 s->background_width, 3122 s->background_width,
3097 s->height - 2 * s->face->box_line_width); 3123 s->height - 2 * box_line_width);
3098 s->background_filled_p = 1; 3124 s->background_filled_p = 1;
3099 } 3125 }
3100 } 3126 }
@@ -3113,7 +3139,7 @@ x_draw_glyph_string_foreground (s)
3113 of S to the right of that box line. */ 3139 of S to the right of that box line. */
3114 if (s->face->box != FACE_NO_BOX 3140 if (s->face->box != FACE_NO_BOX
3115 && s->first_glyph->left_box_line_p) 3141 && s->first_glyph->left_box_line_p)
3116 x = s->x + s->face->box_line_width; 3142 x = s->x + abs (s->face->box_line_width);
3117 else 3143 else
3118 x = s->x; 3144 x = s->x;
3119 3145
@@ -3183,7 +3209,7 @@ x_draw_composite_glyph_string_foreground (s)
3183 of S to the right of that box line. */ 3209 of S to the right of that box line. */
3184 if (s->face->box != FACE_NO_BOX 3210 if (s->face->box != FACE_NO_BOX
3185 && s->first_glyph->left_box_line_p) 3211 && s->first_glyph->left_box_line_p)
3186 x = s->x + s->face->box_line_width; 3212 x = s->x + abs (s->face->box_line_width);
3187 else 3213 else
3188 x = s->x; 3214 x = s->x;
3189 3215
@@ -3801,7 +3827,7 @@ x_draw_glyph_string_box (s)
3801 ? s->first_glyph 3827 ? s->first_glyph
3802 : s->first_glyph + s->nchars - 1); 3828 : s->first_glyph + s->nchars - 1);
3803 3829
3804 width = s->face->box_line_width; 3830 width = abs (s->face->box_line_width);
3805 raised_p = s->face->box == FACE_RAISED_BOX; 3831 raised_p = s->face->box == FACE_RAISED_BOX;
3806 left_x = s->x; 3832 left_x = s->x;
3807 right_x = ((s->row->full_width_p 3833 right_x = ((s->row->full_width_p
@@ -3846,7 +3872,7 @@ x_draw_image_foreground (s)
3846 right of that line. */ 3872 right of that line. */
3847 if (s->face->box != FACE_NO_BOX 3873 if (s->face->box != FACE_NO_BOX
3848 && s->first_glyph->left_box_line_p) 3874 && s->first_glyph->left_box_line_p)
3849 x = s->x + s->face->box_line_width; 3875 x = s->x + abs (s->face->box_line_width);
3850 else 3876 else
3851 x = s->x; 3877 x = s->x;
3852 3878
@@ -3932,7 +3958,7 @@ x_draw_image_relief (s)
3932 right of that line. */ 3958 right of that line. */
3933 if (s->face->box != FACE_NO_BOX 3959 if (s->face->box != FACE_NO_BOX
3934 && s->first_glyph->left_box_line_p) 3960 && s->first_glyph->left_box_line_p)
3935 x = s->x + s->face->box_line_width; 3961 x = s->x + abs (s->face->box_line_width);
3936 else 3962 else
3937 x = s->x; 3963 x = s->x;
3938 3964
@@ -3978,7 +4004,7 @@ x_draw_image_foreground_1 (s, pixmap)
3978 right of that line. */ 4004 right of that line. */
3979 if (s->face->box != FACE_NO_BOX 4005 if (s->face->box != FACE_NO_BOX
3980 && s->first_glyph->left_box_line_p) 4006 && s->first_glyph->left_box_line_p)
3981 x = s->face->box_line_width; 4007 x = abs (s->face->box_line_width);
3982 else 4008 else
3983 x = 0; 4009 x = 0;
3984 4010
@@ -4072,11 +4098,12 @@ x_draw_image_glyph_string (s)
4072 struct glyph_string *s; 4098 struct glyph_string *s;
4073{ 4099{
4074 int x, y; 4100 int x, y;
4075 int box_line_width = s->face->box_line_width; 4101 int box_line_hwidth = abs (s->face->box_line_width);
4102 int box_line_vwidth = max (s->face->box_line_width, 0);
4076 int height; 4103 int height;
4077 Pixmap pixmap = None; 4104 Pixmap pixmap = None;
4078 4105
4079 height = s->height - 2 * box_line_width; 4106 height = s->height - 2 * box_line_vwidth;
4080 4107
4081 /* Fill background with face under the image. Do it only if row is 4108 /* Fill background with face under the image. Do it only if row is
4082 taller than image or if image has a clip mask to reduce 4109 taller than image or if image has a clip mask to reduce
@@ -4089,12 +4116,12 @@ x_draw_image_glyph_string (s)
4089 || s->img->pixmap == 0 4116 || s->img->pixmap == 0
4090 || s->width != s->background_width) 4117 || s->width != s->background_width)
4091 { 4118 {
4092 if (box_line_width && s->first_glyph->left_box_line_p) 4119 if (box_line_hwidth && s->first_glyph->left_box_line_p)
4093 x = s->x + box_line_width; 4120 x = s->x + box_line_hwidth;
4094 else 4121 else
4095 x = s->x; 4122 x = s->x;
4096 4123
4097 y = s->y + box_line_width; 4124 y = s->y + box_line_vwidth;
4098 4125
4099 if (s->img->mask) 4126 if (s->img->mask)
4100 { 4127 {