aboutsummaryrefslogtreecommitdiffstats
path: root/src/pgtkterm.c
diff options
context:
space:
mode:
authorPo Lu1970-01-01 00:00:00 +0000
committerPo Lu2024-04-28 11:58:22 +0800
commit77a170a175dfeb17dab23e41668b8497b8b3b9d7 (patch)
tree91bfe9fde05be0246fae36ef9daa6a755bcef500 /src/pgtkterm.c
parent4992df159157806bcbad87569f34dc5136c96601 (diff)
downloademacs-77a170a175dfeb17dab23e41668b8497b8b3b9d7.tar.gz
emacs-77a170a175dfeb17dab23e41668b8497b8b3b9d7.zip
Port double-line underlines to GUI systems
* src/xterm.c (x_get_scale_factor): Replace display in first argument with a pointer to dpyinfo. (x_draw_underwave): Adjust to match. (x_draw_glyph_string): Implement double-line underlines. * src/androidterm.c (android_get_scale_factor) (android_draw_glyph_string): * src/haikuterm.c (haiku_draw_text_decoration): * src/nsterm.m (ns_draw_text_decoration): * src/pgtkterm.c (pgtk_draw_glyph_string): * src/w32term.c (w32_draw_glyph_string): Synchronize with X. * src/xfaces.c (realize_gui_face): Enable `double-line' on window systems.
Diffstat (limited to 'src/pgtkterm.c')
-rw-r--r--src/pgtkterm.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index e08e4b2b230..8441189ab8d 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -2553,13 +2553,17 @@ pgtk_draw_glyph_string (struct glyph_string *s)
2553 else 2553 else
2554 pgtk_draw_underwave (s, s->face->underline_color); 2554 pgtk_draw_underwave (s, s->face->underline_color);
2555 } 2555 }
2556 else if (s->face->underline == FACE_UNDERLINE_SINGLE) 2556 else if (s->face->underline == FACE_UNDERLINE_SINGLE
2557 || s->face->underline == FACE_UNDERLINE_DOUBLE_LINE)
2557 { 2558 {
2558 unsigned long thickness, position; 2559 unsigned long thickness, position;
2559 int y; 2560 int y;
2561 unsigned long foreground;
2560 2562
2561 if (s->prev 2563 if (s->prev
2562 && s->prev->face->underline == FACE_UNDERLINE_SINGLE 2564 && ((s->prev->face->underline == FACE_UNDERLINE_SINGLE)
2565 || (s->prev->face->underline
2566 == FACE_UNDERLINE_DOUBLE_LINE))
2563 && (s->prev->face->underline_at_descent_line_p 2567 && (s->prev->face->underline_at_descent_line_p
2564 == s->face->underline_at_descent_line_p) 2568 == s->face->underline_at_descent_line_p)
2565 && (s->prev->face->underline_pixels_above_descent_line 2569 && (s->prev->face->underline_pixels_above_descent_line
@@ -2616,15 +2620,25 @@ pgtk_draw_glyph_string (struct glyph_string *s)
2616 s->underline_thickness = thickness; 2620 s->underline_thickness = thickness;
2617 s->underline_position = position; 2621 s->underline_position = position;
2618 y = s->ybase + position; 2622 y = s->ybase + position;
2623
2619 if (s->face->underline_defaulted_p) 2624 if (s->face->underline_defaulted_p)
2620 pgtk_fill_rectangle (s->f, s->xgcv.foreground, 2625 foreground = s->xgcv.foreground;
2621 s->x, y, s->width, thickness,
2622 false);
2623 else 2626 else
2627 foreground = s->face->underline_color;
2628
2629 pgtk_fill_rectangle (s->f, foreground, s->x, y, s->width,
2630 thickness, false);
2631
2632 /* Place a second underline above the first if this was
2633 requested in the face specification. */
2634
2635 if (s->face->underline == FACE_UNDERLINE_DOUBLE_LINE)
2624 { 2636 {
2625 pgtk_fill_rectangle (s->f, s->face->underline_color, 2637 /* Compute the position of the second underline. */
2626 s->x, y, s->width, thickness, 2638 position = position - thickness - 1;
2627 false); 2639 y = s->ybase + position;
2640 pgtk_fill_rectangle (s->f, foreground, s->x, y, s->width,
2641 thickness, false);
2628 } 2642 }
2629 } 2643 }
2630 } 2644 }