From: Pip Cet <pipcet@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: dfussner@googlemail.com, 41645@debbugs.gnu.org
Subject: bug#41645: 27.0.91; Combining Grapheme Joiner (#x34f) gui artifacts
Date: Thu, 04 Jun 2020 06:58:47 +0000 [thread overview]
Message-ID: <87h7vr5nbs.fsf@gmail.com> (raw)
In-Reply-To: <83zh9jblqj.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 04 Jun 2020 05:36:36 +0300")
[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Pip Cet <pipcet@gmail.com>
>> Cc: dfussner@googlemail.com, 41645@debbugs.gnu.org
>> Date: Wed, 03 Jun 2020 20:23:47 +0000
>>
>> diff --git a/src/xdisp.c b/src/xdisp.c
>> index 0f06a38d40..414dc8809b 100644
>> --- a/src/xdisp.c
>> +++ b/src/xdisp.c
>> @@ -30592,6 +30592,12 @@ gui_produce_glyphs (struct it *it)
>> it->glyph_row->contains_overlapping_glyphs_p = true;
>>
>> it->pixel_width = cmp->pixel_width;
>> + if (it->pixel_width == 0)
>> + {
>> + /* We assure that all visible glyphs have at least 1-pixel
>> + width. */
>> + it->pixel_width = 1;
>> + }
>> it->ascent = it->phys_ascent = cmp->ascent;
>> it->descent = it->phys_descent = cmp->descent;
>> IT_APPLY_FACE_BOX(it, face);
>> @@ -30623,6 +30629,12 @@ gui_produce_glyphs (struct it *it)
>> it->pixel_width
>> = composition_gstring_width (gstring, it->cmp_it.from, it->cmp_it.to,
>> &metrics);
>> + if (it->pixel_width == 0)
>> + {
>> + /* We assure that all visible glyphs have at least 1-pixel
>> + width. */
>> + it->pixel_width = 1;
>> + }
>> if (it->glyph_row
>> && (metrics.lbearing < 0 || metrics.rbearing > metrics.width))
>> it->glyph_row->contains_overlapping_glyphs_p = true;
>
> I like this less than your original proposal.
Okay, so do I. I'd misunderstoond your previous comment, then.
> Artificially "fixing"
> the pixel width of a glyph without changing anything else might get us
> in trouble, since the font glyph is still zero-width and its other
> metrics are incompatible with this "fixed" value.
>
> Why did you prefer this to the original proposal, which was to set the
> font_not_found_p flag?
Is this any better? I'm not sure what to do about static compositions,
to be honest, so maybe we shouldn't touch those at all. What do you think?
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Avoid-zero-width-glyphs-and-the-resulting-cursor-art.patch --]
[-- Type: text/x-diff, Size: 3285 bytes --]
From 6efd912c82be9c071f5a02eb67ffcc0d6b6ebc2e Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
Date: Thu, 4 Jun 2020 06:55:57 +0000
Subject: [PATCH] Avoid zero-width glyphs and the resulting cursor artifacts
* src/xdisp.c (fill_gstring_glyph_string): Handle unavailable glyphs.
(append_composite_glyph): Mark unavailable glyphs.
(gui_produce_glyphs): Make glyphs unavailable for zero-width
compositions. (Bug#41645)
---
src/xdisp.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/xdisp.c b/src/xdisp.c
index 327e8a183b..5fb278c420 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -27689,10 +27689,12 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id,
struct glyph *glyph, *last;
Lisp_Object lgstring;
int i;
+ bool glyph_not_available_p;
s->for_overlaps = overlaps;
glyph = s->row->glyphs[s->area] + start;
last = s->row->glyphs[s->area] + end;
+ glyph_not_available_p = glyph->glyph_not_available_p;
s->cmp_id = glyph->u.cmp.id;
s->cmp_from = glyph->slice.cmp.from;
s->cmp_to = glyph->slice.cmp.to + 1;
@@ -27707,7 +27709,8 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id,
&& glyph->u.cmp.automatic
&& glyph->u.cmp.id == s->cmp_id
&& glyph->face_id == face_id
- && s->cmp_to == glyph->slice.cmp.from)
+ && s->cmp_to == glyph->slice.cmp.from
+ && glyph->glyph_not_available_p == glyph_not_available_p)
{
s->width += glyph->pixel_width;
s->cmp_to = (glyph++)->slice.cmp.to + 1;
@@ -27722,6 +27725,14 @@ fill_gstring_glyph_string (struct glyph_string *s, int face_id,
s->char2b[i] = code & 0xFFFF;
}
+ /* If the specified font could not be loaded, record that fact in
+ S->font_not_found_p so that we can draw rectangles for the
+ characters of the glyph string. */
+ if (glyph_not_available_p)
+ {
+ s->font_not_found_p = true;
+ }
+
return glyph - s->row->glyphs[s->area];
}
@@ -28918,7 +28929,7 @@ append_composite_glyph (struct it *it)
glyph->overlaps_vertically_p = (it->phys_ascent > it->ascent
|| it->phys_descent > it->descent);
glyph->padding_p = false;
- glyph->glyph_not_available_p = false;
+ glyph->glyph_not_available_p = it->glyph_not_available_p;
glyph->face_id = it->face_id;
glyph->font_type = FONT_TYPE_UNKNOWN;
if (it->bidi_p)
@@ -30595,6 +30606,11 @@ gui_produce_glyphs (struct it *it)
it->glyph_row->contains_overlapping_glyphs_p = true;
it->pixel_width = cmp->pixel_width;
+ if (it->pixel_width == 0)
+ {
+ it->glyph_not_available_p = true;
+ it->pixel_width = font->space_width;
+ }
it->ascent = it->phys_ascent = cmp->ascent;
it->descent = it->phys_descent = cmp->descent;
IT_APPLY_FACE_BOX(it, face);
@@ -30626,6 +30642,11 @@ gui_produce_glyphs (struct it *it)
it->pixel_width
= composition_gstring_width (gstring, it->cmp_it.from, it->cmp_it.to,
&metrics);
+ if (it->pixel_width == 0)
+ {
+ it->glyph_not_available_p = true;
+ it->pixel_width = face->font->space_width;
+ }
if (it->glyph_row
&& (metrics.lbearing < 0 || metrics.rbearing > metrics.width))
it->glyph_row->contains_overlapping_glyphs_p = true;
--
2.27.0.rc0
next prev parent reply other threads:[~2020-06-04 6:58 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-01 13:45 bug#41645: 27.0.91; Combining Grapheme Joiner (#x34f) gui artifacts David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-01 15:29 ` Eli Zaretskii
2020-06-01 15:50 ` Pip Cet
2020-06-01 16:06 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-01 16:36 ` Eli Zaretskii
2020-06-01 17:44 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-01 18:27 ` Pip Cet
2020-06-01 16:14 ` Eli Zaretskii
2020-06-01 18:09 ` Pip Cet
2020-06-01 18:37 ` Eli Zaretskii
2020-06-01 19:35 ` Eli Zaretskii
2020-06-01 20:15 ` Pip Cet
2020-06-01 19:48 ` Pip Cet
2020-06-01 22:37 ` Pip Cet
2020-06-02 13:45 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-02 13:57 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-02 14:06 ` Pip Cet
2020-06-02 14:32 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-02 14:35 ` Pip Cet
2020-06-02 14:39 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-02 15:51 ` Eli Zaretskii
2020-06-02 15:59 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-02 16:07 ` Eli Zaretskii
2020-06-02 19:21 ` Pip Cet
2020-06-02 19:49 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-03 14:20 ` Eli Zaretskii
2020-06-03 14:58 ` Pip Cet
2020-06-03 15:58 ` Eli Zaretskii
2020-06-03 20:23 ` Pip Cet
2020-06-04 2:36 ` Eli Zaretskii
2020-06-04 6:58 ` Pip Cet [this message]
2020-06-04 13:31 ` Eli Zaretskii
[not found] ` <874krq4fd8.fsf@gmail.com>
2020-06-05 7:45 ` Eli Zaretskii
2020-06-05 8:31 ` Pip Cet
2020-06-05 15:54 ` David Fussner via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-06-05 17:28 ` Eli Zaretskii
2020-06-02 15:52 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h7vr5nbs.fsf@gmail.com \
--to=pipcet@gmail.com \
--cc=41645@debbugs.gnu.org \
--cc=dfussner@googlemail.com \
--cc=eliz@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).