From f032a318307096c87c4c19928e623e30175d9b1a Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Fri, 4 Jan 2013 10:58:07 +0900 Subject: Make underwave look more triangular and also degrade gracefully for small fonts. (Bug#13000) --- src/ChangeLog | 7 +++++++ src/nsterm.m | 12 ++++++------ src/w32term.c | 4 ++-- src/xterm.c | 4 ++-- 4 files changed, 17 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index ea882770765..8699dc12d9b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2013-01-04 YAMAMOTO Mitsuharu + + * nsterm.m (ns_draw_underwave): + * w32term.c (w32_draw_underwave): + * xterm.c (x_draw_underwave): Make underwave look more triangular + and also degrade gracefully for small fonts. (Bug#13000) + 2012-12-31 Glenn Morris * keymap.c (Fkey_description): Doc fix. (Bug#13323) diff --git a/src/nsterm.m b/src/nsterm.m index d9ebf714a9a..fce43587b11 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2554,7 +2554,7 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) Draw a wavy line under glyph string s. The wave fills wave_height pixels from y. - x wave_length = 3 + x wave_length = 2 -- y * * * * * |* * * * * * * * * @@ -2564,14 +2564,14 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) static void ns_draw_underwave (struct glyph_string *s, CGFloat width, CGFloat x) { - int wave_height = 3, wave_length = 3; + int wave_height = 3, wave_length = 2; int y, dx, dy, odd, xmax; NSPoint a, b; NSRect waveClip; dx = wave_length; dy = wave_height - 1; - y = s->ybase + 1; + y = s->ybase - wave_height + 3; xmax = x + width; /* Find and set clipping rectangle */ @@ -2580,10 +2580,10 @@ ns_draw_underwave (struct glyph_string *s, CGFloat width, CGFloat x) NSRectClip (waveClip); /* Draw the waves */ - a.x = x - ((int)(x) % dx); + a.x = x - ((int)(x) % dx) + 0.5; b.x = a.x + dx; odd = (int)(a.x/dx) % 2; - a.y = b.y = y; + a.y = b.y = y + 0.5; if (odd) a.y += dy; @@ -2594,7 +2594,7 @@ ns_draw_underwave (struct glyph_string *s, CGFloat width, CGFloat x) { [NSBezierPath strokeLineFromPoint:a toPoint:b]; a.x = b.x, a.y = b.y; - b.x += dx, b.y = y + odd*dy; + b.x += dx, b.y = y + 0.5 + odd*dy; odd = !odd; } diff --git a/src/w32term.c b/src/w32term.c index d7a76ccf773..84afd8c300b 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -356,7 +356,7 @@ w32_restore_glyph_string_clip (struct glyph_string *s) void w32_draw_underwave (struct glyph_string *s, COLORREF color) { - int wave_height = 2, wave_length = 3; + int wave_height = 3, wave_length = 2; int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax; XRectangle wave_clip, string_clip, final_clip; RECT w32_final_clip, w32_string_clip; @@ -365,7 +365,7 @@ w32_draw_underwave (struct glyph_string *s, COLORREF color) dx = wave_length; dy = wave_height - 1; x0 = s->x; - y0 = s->ybase + 1; + y0 = s->ybase - wave_height + 3; width = s->width; xmax = x0 + width; diff --git a/src/xterm.c b/src/xterm.c index 47a38eeefae..32b19b5cffb 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2656,14 +2656,14 @@ x_draw_stretch_glyph_string (struct glyph_string *s) static void x_draw_underwave (struct glyph_string *s) { - int wave_height = 2, wave_length = 3; + int wave_height = 3, wave_length = 2; int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax; XRectangle wave_clip, string_clip, final_clip; dx = wave_length; dy = wave_height - 1; x0 = s->x; - y0 = s->ybase + 1; + y0 = s->ybase - wave_height + 3; width = s->width; xmax = x0 + width; -- cgit v1.2.1 From 4240dd3cef858e4431bb349925c755d793c560b3 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Fri, 4 Jan 2013 11:05:33 +0900 Subject: Don't use previous underline thickness or position if previous underline type is underwave. --- src/ChangeLog | 5 +++++ src/nsterm.m | 1 + src/w32term.c | 3 ++- src/xterm.c | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 8699dc12d9b..9e315700e8a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -5,6 +5,11 @@ * xterm.c (x_draw_underwave): Make underwave look more triangular and also degrade gracefully for small fonts. (Bug#13000) + * nsterm.m (ns_draw_text_decoration): + * w32term.c (x_draw_glyph_string): + * xterm.c (x_draw_glyph_string): Don't use previous underline + thickness and position if previous underline type is underwave. + 2012-12-31 Glenn Morris * keymap.c (Fkey_description): Doc fix. (Bug#13323) diff --git a/src/nsterm.m b/src/nsterm.m index fce43587b11..a57e744d3c2 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2634,6 +2634,7 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face, /* If the prev was underlined, match its appearance. */ if (s->prev && s->prev->face->underline_p + && s->prev->face->underline_type == FACE_UNDER_LINE && s->prev->underline_thickness > 0) { thickness = s->prev->underline_thickness; diff --git a/src/w32term.c b/src/w32term.c index 84afd8c300b..8b9414b9cfb 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2464,7 +2464,8 @@ x_draw_glyph_string (struct glyph_string *s) unsigned long thickness, position; int y; - if (s->prev && s->prev->face->underline_p) + if (s->prev && s->prev->face->underline_p + && s->prev->face->underline_type == FACE_UNDER_LINE) { /* We use the same underline style as the previous one. */ thickness = s->prev->underline_thickness; diff --git a/src/xterm.c b/src/xterm.c index 32b19b5cffb..fb407c87611 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2825,7 +2825,8 @@ x_draw_glyph_string (struct glyph_string *s) unsigned long thickness, position; int y; - if (s->prev && s->prev->face->underline_p) + if (s->prev && s->prev->face->underline_p + && s->prev->face->underline_type == FACE_UNDER_LINE) { /* We use the same underline style as the previous one. */ thickness = s->prev->underline_thickness; -- cgit v1.2.1