diff options
| author | Eli Zaretskii | 2017-03-02 17:37:18 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-03-02 17:37:18 +0200 |
| commit | 511a3c3ba27352fde26ae2371a9d4a64c6418122 (patch) | |
| tree | b5683586c5de0e2bb97fa8cf207e1b3e0b782812 /src/w32term.c | |
| parent | ae8835619655a0e28c4d84bbd8c46cc29aac6ad3 (diff) | |
| download | emacs-511a3c3ba27352fde26ae2371a9d4a64c6418122.tar.gz emacs-511a3c3ba27352fde26ae2371a9d4a64c6418122.zip | |
Fix display of strike-through text in variable-height lines
* src/nsterm.m (ns_draw_text_decoration):
* src/xterm.c (x_draw_glyph_string):
* src/w32term.c (x_draw_glyph_string): Fix calculation of the
strike-through y-coordinate for a glyph row which is taller than
the strike-through text. (Bug#25907)
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/w32term.c b/src/w32term.c index 3d41c30dfe0..28bf6fb3d9f 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -2500,18 +2500,27 @@ x_draw_glyph_string (struct glyph_string *s) | |||
| 2500 | if (s->face->strike_through_p | 2500 | if (s->face->strike_through_p |
| 2501 | && !FONT_TEXTMETRIC (s->font).tmStruckOut) | 2501 | && !FONT_TEXTMETRIC (s->font).tmStruckOut) |
| 2502 | { | 2502 | { |
| 2503 | /* Y-coordinate and height of the glyph string's first | ||
| 2504 | glyph. We cannot use s->y and s->height because those | ||
| 2505 | could be larger if there are taller display elements | ||
| 2506 | (e.g., characters displayed with a larger font) in the | ||
| 2507 | same glyph row. */ | ||
| 2508 | int glyph_y = s->ybase - s->first_glyph->ascent; | ||
| 2509 | int glyph_height = s->first_glyph->ascent + s->first_glyph->descent; | ||
| 2510 | /* Strike-through width and offset from the glyph string's | ||
| 2511 | top edge. */ | ||
| 2503 | unsigned long h = 1; | 2512 | unsigned long h = 1; |
| 2504 | unsigned long dy = (s->height - h) / 2; | 2513 | unsigned long dy = (glyph_height - h) / 2; |
| 2505 | 2514 | ||
| 2506 | if (s->face->strike_through_color_defaulted_p) | 2515 | if (s->face->strike_through_color_defaulted_p) |
| 2507 | { | 2516 | { |
| 2508 | w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, s->y + dy, | 2517 | w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, |
| 2509 | s->width, h); | 2518 | glyph_y + dy, s->width, h); |
| 2510 | } | 2519 | } |
| 2511 | else | 2520 | else |
| 2512 | { | 2521 | { |
| 2513 | w32_fill_area (s->f, s->hdc, s->face->strike_through_color, s->x, | 2522 | w32_fill_area (s->f, s->hdc, s->face->strike_through_color, s->x, |
| 2514 | s->y + dy, s->width, h); | 2523 | glyph_y + dy, s->width, h); |
| 2515 | } | 2524 | } |
| 2516 | } | 2525 | } |
| 2517 | 2526 | ||