Mercurial > emacs
comparison src/xterm.c @ 36005:58a1ada9bf57
(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.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 09 Feb 2001 12:33:58 +0000 |
parents | 02652537e9d2 |
children | 68c02499d990 |
comparison
equal
deleted
inserted
replaced
36004:a77b9157dd49 | 36005:58a1ada9bf57 |
---|---|
1514 | 1514 |
1515 it->nglyphs = 1; | 1515 it->nglyphs = 1; |
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); |
1529 | 1532 |
1530 if (it->glyph_row) | 1533 if (it->glyph_row) |
1725 it->descent = it->phys_descent = height - it->ascent; | 1728 it->descent = it->phys_descent = height - it->ascent; |
1726 it->nglyphs = 1; | 1729 it->nglyphs = 1; |
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); |
1740 } | 1746 } |
1741 | 1747 |
1888 right, add the box line width to the character's width. */ | 1894 right, add the box line width to the character's width. */ |
1889 if (face->box != FACE_NO_BOX) | 1895 if (face->box != FACE_NO_BOX) |
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) |
1899 it->pixel_width += thick; | 1910 it->pixel_width += thick; |
1900 } | 1911 } |
1933 it->pixel_width = 0; | 1944 it->pixel_width = 0; |
1934 it->nglyphs = 0; | 1945 it->nglyphs = 0; |
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') |
1946 { | 1957 { |
1947 int tab_width = it->tab_width * CANON_X_UNIT (it->f); | 1958 int tab_width = it->tab_width * CANON_X_UNIT (it->f); |
2002 it->ascent = font->ascent + boff; | 2013 it->ascent = font->ascent + boff; |
2003 it->descent = font->descent - boff; | 2014 it->descent = font->descent - boff; |
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; |
2012 if (it->end_of_box_run_p) | 2029 if (it->end_of_box_run_p) |
2013 it->pixel_width += thick; | 2030 it->pixel_width += thick; |
2269 it->descent = it->phys_descent = cmp->descent; | 2286 it->descent = it->phys_descent = cmp->descent; |
2270 | 2287 |
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; |
2279 if (it->end_of_box_run_p) | 2302 if (it->end_of_box_run_p) |
2280 it->pixel_width += thick; | 2303 it->pixel_width += thick; |
2327 struct face *face = FACE_FROM_ID (f, face_id); | 2350 struct face *face = FACE_FROM_ID (f, face_id); |
2328 if (face) | 2351 if (face) |
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 |
2336 return height; | 2360 return height; |
2337 } | 2361 } |
3074 { | 3098 { |
3075 /* Nothing to do if background has already been drawn or if it | 3099 /* Nothing to do if background has already been drawn or if it |
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 } |
3101 } | 3127 } |
3102 | 3128 |
3111 | 3137 |
3112 /* If first glyph of S has a left box line, start drawing the text | 3138 /* If first glyph of S has a left box line, start drawing the text |
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 |
3120 /* Draw characters of S as rectangles if S's font could not be | 3146 /* Draw characters of S as rectangles if S's font could not be |
3121 loaded. */ | 3147 loaded. */ |
3181 | 3207 |
3182 /* If first glyph of S has a left box line, start drawing the text | 3208 /* If first glyph of S has a left box line, start drawing the text |
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 |
3190 /* S is a glyph string for a composition. S->gidx is the index of | 3216 /* S is a glyph string for a composition. S->gidx is the index of |
3191 the first character drawn for glyphs of this composition. | 3217 the first character drawn for glyphs of this composition. |
3799 /* The glyph that may have a right box line. */ | 3825 /* The glyph that may have a right box line. */ |
3800 last_glyph = (s->cmp || s->img | 3826 last_glyph = (s->cmp || s->img |
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 |
3808 ? last_x - 1 | 3834 ? last_x - 1 |
3809 : min (last_x, s->x + s->background_width) - 1)); | 3835 : min (last_x, s->x + s->background_width) - 1)); |
3844 | 3870 |
3845 /* If first glyph of S has a left box line, start drawing it to the | 3871 /* If first glyph of S has a left box line, start drawing it to the |
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 |
3853 /* If there is a margin around the image, adjust x- and y-position | 3879 /* If there is a margin around the image, adjust x- and y-position |
3854 by that margin. */ | 3880 by that margin. */ |
3930 | 3956 |
3931 /* If first glyph of S has a left box line, start drawing it to the | 3957 /* If first glyph of S has a left box line, start drawing it to the |
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 |
3939 /* If there is a margin around the image, adjust x- and y-position | 3965 /* If there is a margin around the image, adjust x- and y-position |
3940 by that margin. */ | 3966 by that margin. */ |
3976 | 4002 |
3977 /* If first glyph of S has a left box line, start drawing it to the | 4003 /* If first glyph of S has a left box line, start drawing it to the |
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 |
3985 /* If there is a margin around the image, adjust x- and y-position | 4011 /* If there is a margin around the image, adjust x- and y-position |
3986 by that margin. */ | 4012 by that margin. */ |
4070 static void | 4096 static void |
4071 x_draw_image_glyph_string (s) | 4097 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 |
4083 flickering. */ | 4110 flickering. */ |
4084 s->stippled_p = s->face->stipple != 0; | 4111 s->stippled_p = s->face->stipple != 0; |
4087 || s->img->vmargin | 4114 || s->img->vmargin |
4088 || s->img->mask | 4115 || s->img->mask |
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 { |
4101 /* Create a pixmap as large as the glyph string. Fill it | 4128 /* Create a pixmap as large as the glyph string. Fill it |
4102 with the background color. Copy the image to it, using | 4129 with the background color. Copy the image to it, using |