diff options
| author | Eli Zaretskii | 2017-03-06 18:22:53 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2017-03-06 18:22:53 +0200 |
| commit | eae5dcd57d1a73688ccb576decbf90fa711105e7 (patch) | |
| tree | 3418f0885a938b27aa016dc4eee5770f4d98eb44 /src/xterm.c | |
| parent | 0fae08d0072f74d97ca70b91a4d46d8d28a03952 (diff) | |
| download | emacs-eae5dcd57d1a73688ccb576decbf90fa711105e7.tar.gz emacs-eae5dcd57d1a73688ccb576decbf90fa711105e7.zip | |
A better fix for bug#25845
* src/xdisp.c (font_for_underline_metrics): New function.
* src/dispextern.h: Add its prototype.
* src/xterm.c (x_draw_glyph_string):
* src/w32term.c (x_draw_glyph_string):
* src/nsterm.m (ns_draw_text_decoration): Call it. This avoids
having identical code 3 times in 3 different files.
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/src/xterm.c b/src/xterm.c index 57e64c48887..28faea14a3a 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3636,27 +3636,7 @@ x_draw_glyph_string (struct glyph_string *s) | |||
| 3636 | } | 3636 | } |
| 3637 | else | 3637 | else |
| 3638 | { | 3638 | { |
| 3639 | /* If we are drawing in the middle of a glyph row, | 3639 | struct font *font = font_for_underline_metrics (s); |
| 3640 | find the first glyph in the run of underlined | ||
| 3641 | glyphs preceding the beginning of glyph string S. | ||
| 3642 | This is because that glyph determines the | ||
| 3643 | underline position and thickness for the entire | ||
| 3644 | run of the underlined glyphs. */ | ||
| 3645 | struct glyph *g0 = s->row->glyphs[s->area], *g; | ||
| 3646 | |||
| 3647 | for (g = s->first_glyph - 1; g >= g0; g--) | ||
| 3648 | { | ||
| 3649 | struct face *prev_face = FACE_FROM_ID (s->f, g->face_id); | ||
| 3650 | if (!(prev_face && prev_face->underline_p)) | ||
| 3651 | break; | ||
| 3652 | } | ||
| 3653 | |||
| 3654 | /* Now use the font of the last glyph we saw that | ||
| 3655 | still has the underlined_p flag set. */ | ||
| 3656 | struct face *glyph_face = FACE_FROM_ID (s->f, g[1].face_id); | ||
| 3657 | struct font *font = glyph_face->font; | ||
| 3658 | if (font) | ||
| 3659 | font_prepare_for_face (s->f, glyph_face); | ||
| 3660 | 3640 | ||
| 3661 | /* Get the underline thickness. Default is 1 pixel. */ | 3641 | /* Get the underline thickness. Default is 1 pixel. */ |
| 3662 | if (font && font->underline_thickness > 0) | 3642 | if (font && font->underline_thickness > 0) |