summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2013-01-04 11:22:37 -0800
committerGlenn Morris <rgm@gnu.org>2013-01-04 11:22:37 -0800
commit0f668a4db4a33f98f84613513af3efea521b4847 (patch)
treeab85f709ca11c2390dddfc1756656293d6762e55 /src
parent4a1b123d1517bcad22f936df9c39b61fbc3e5359 (diff)
parent92d596112248baecbe6789d450d8e8ea405de19b (diff)
downloademacs-0f668a4db4a33f98f84613513af3efea521b4847.tar.gz
Merge from emacs-24; up to 2012-12-06T20:16:38Z!monnier@iro.umontreal.ca
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/nsterm.m13
-rw-r--r--src/w32term.c7
-rw-r--r--src/xterm.c7
4 files changed, 27 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 5205ef4625e..8fc876e248c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
+2013-01-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * 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)
+
+ * 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.
+
2013-01-04 Stefan Monnier <monnier@iro.umontreal.ca>
* fileio.c (Ffile_acl): Undocument return format.
diff --git a/src/nsterm.m b/src/nsterm.m
index c8ce484a432..0fd062b7f17 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -2566,7 +2566,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 * * * * *
|* * * * * * * * *
@@ -2576,14 +2576,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 */
@@ -2592,10 +2592,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;
@@ -2606,7 +2606,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;
}
@@ -2646,6 +2646,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 c5681438bfe..36ae4d7797f 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -358,7 +358,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;
@@ -367,7 +367,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;
@@ -2456,7 +2456,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 e9c4709d999..f63f10566f6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -2631,14 +2631,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;
@@ -2800,7 +2800,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;