From ae185452070444d89db7f1069c58cfa27a5e15b0 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 25 Feb 2008 01:52:35 +0000 Subject: [PATCH] (struct glyph_string): New member padding_p. --- src/ChangeLog | 19 +++++++++++++++++++ src/dispextern.h | 22 +++++++++++++++------- src/xdisp.c | 19 +++++++++++++++---- 3 files changed, 49 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 71026e1d77e..263168d128b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,22 @@ +2008-02-25 Kenichi Handa + + * xdisp.c (fill_glyph_string): Pay attention to glyph->padding_p. + (append_glyph): Set glyph->pixel_width and glyph->padding_p to 1 + if the glyph in the font is zero pixel with. + + * dispextern.h (struct glyph_string): New member padding_p. + + * w32font.c (w32font_draw): Pay attention to s->padding_p. + + * ftxfont.c (ftxfont_draw): Pay attention to s->padding_p. + + * xfont.c (xfont_draw): Pay attention to s->padding_p. + + * xftfont.c (xftfont_draw): Pay attention to s->padding_p. + + * font.c: If the font driver doesn't have `shape' function, return + Qnil. + 2008-02-25 Jason Rumney * w32fns.c (enum_font_cb2): Don't use raster fonts for Unicode. diff --git a/src/dispextern.h b/src/dispextern.h index ea5a077d7b2..652980be783 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -351,13 +351,16 @@ struct glyph glyphs above or below it. */ unsigned overlaps_vertically_p : 1; - /* 1 means glyph is a padding glyph. Padding glyphs are used for - characters whose visual shape consists of more than one glyph - (e.g. Asian characters). All but the first glyph of such a glyph - sequence have the padding_p flag set. Only used for terminal - frames, and there only to minimize code changes. A better way - would probably be to use the width field of glyphs to express - padding. */ + /* For terminal frames, 1 means glyph is a padding glyph. Padding + glyphs are used for characters whose visual shape consists of + more than one glyph (e.g. Asian characters). All but the first + glyph of such a glyph sequence have the padding_p flag set. This + flag is used only to minimize code changes. A better way would + probably be to use the width field of glyphs to express padding. + + For graphic frames, 1 means the pixel width of the glyph in a + font is 0, but 1-pixel is padded on displaying for correct cursor + displaying. The member `pixel_width' above is set to 1. */ unsigned padding_p : 1; /* 1 means the actual glyph is not available, draw a box instead. @@ -1197,6 +1200,11 @@ struct glyph_string respectively. */ unsigned for_overlaps : 3; + /* 1 means that all glyphs in this glyph string has the flag + padding_p set, and thus must be drawn one by one to have 1-pixel + width even though the logical width in the font is zero. */ + unsigned padding_p : 1; + /* The GC to use for drawing this glyph string. */ #if defined(HAVE_X_WINDOWS) || defined(MAC_OS) GC gc; diff --git a/src/xdisp.c b/src/xdisp.c index 588d145e9e1..1e2a667330e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -19409,7 +19409,7 @@ fill_glyph_string (s, face_id, start, end, overlaps) glyph = s->row->glyphs[s->area] + start; last = s->row->glyphs[s->area] + end; voffset = glyph->voffset; - + s->padding_p = glyph->padding_p; glyph_not_available_p = glyph->glyph_not_available_p; while (glyph < last @@ -19428,7 +19428,8 @@ fill_glyph_string (s, face_id, start, end, overlaps) ++s->nchars; xassert (s->nchars <= end - start); s->width += glyph->pixel_width; - ++glyph; + if (glyph++->padding_p != s->padding_p) + break; } s->font = s->face->font; @@ -20181,7 +20182,18 @@ append_glyph (it) { glyph->charpos = CHARPOS (it->position); glyph->object = it->object; - glyph->pixel_width = it->pixel_width; + if (it->pixel_width > 0) + { + glyph->pixel_width = it->pixel_width; + glyph->padding_p = 0; + } + else + { + /* Assure at least 1-pixel width. Otherwise, cursor can't + be displayed correctly. */ + glyph->pixel_width = 1; + glyph->padding_p = 1; + } glyph->ascent = it->ascent; glyph->descent = it->descent; glyph->voffset = it->voffset; @@ -20191,7 +20203,6 @@ append_glyph (it) glyph->right_box_line_p = it->end_of_box_run_p; glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent || it->phys_descent > it->descent); - glyph->padding_p = 0; glyph->glyph_not_available_p = it->glyph_not_available_p; glyph->face_id = it->face_id; glyph->u.ch = it->char_to_display; -- 2.39.5