From ace1f32ac1185cad0c43e4b793fe53b54be95161 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 19 Apr 2022 01:15:33 +0000 Subject: [PATCH] Fix display of glyphless characters on Haiku * src/haikuterm.c (haiku_draw_glyph_string_foreground): Fix pen size when drawing composite string w/o font. (haiku_draw_glyphless_glyph_string_foreground): Correctly display glyphless character rectangle. --- src/haikuterm.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/haikuterm.c b/src/haikuterm.c index 203bfa3f81a..9cd1d0f0158 100644 --- a/src/haikuterm.c +++ b/src/haikuterm.c @@ -1059,6 +1059,8 @@ haiku_draw_glyph_string_foreground (struct glyph_string *s) for (i = 0; i < s->nchars; ++i) { struct glyph *g = s->first_glyph + i; + + BView_SetPenSize (view, 1); BView_StrokeRectangle (view, x, s->y, g->pixel_width, s->height); x += g->pixel_width; @@ -1090,6 +1092,7 @@ haiku_draw_glyphless_glyph_string_foreground (struct glyph_string *s) unsigned char2b[8]; int x, i, j; struct face *face = s->face; + unsigned long color; /* If first glyph of S has a left box line, start drawing the text of S to the right of that box line. */ @@ -1153,11 +1156,21 @@ haiku_draw_glyphless_glyph_string_foreground (struct glyph_string *s) s->ybase + glyph->slice.glyphless.lower_yoff, false); } + if (glyph->u.glyphless.method != GLYPHLESS_DISPLAY_THIN_SPACE) - BView_FillRectangle (FRAME_HAIKU_VIEW (s->f), - x, s->ybase - glyph->ascent, - glyph->pixel_width - 1, - glyph->ascent + glyph->descent - 1); + { + if (s->hl == DRAW_CURSOR) + haiku_merge_cursor_foreground (s, NULL, &color); + else + color = s->face->foreground; + + BView_SetHighColor (FRAME_HAIKU_VIEW (s->f), color); + BView_SetPenSize (FRAME_HAIKU_VIEW (s->f), 1); + BView_StrokeRectangle (FRAME_HAIKU_VIEW (s->f), + x, s->ybase - glyph->ascent, + glyph->pixel_width - 1, + glyph->ascent + glyph->descent - 1); + } x += glyph->pixel_width; } } -- 2.39.2