From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.bugs Subject: bug#41645: 27.0.91; Combining Grapheme Joiner (#x34f) gui artifacts Date: Thu, 04 Jun 2020 06:58:47 +0000 Message-ID: <87h7vr5nbs.fsf@gmail.com> References: <83zh9merd4.fsf@gnu.org> <83wo4qepab.fsf@gnu.org> <83lfl6eiod.fsf@gnu.org> <83zh9lcuyg.fsf@gnu.org> <87o8q1xohw.fsf@gmail.com> <83d06gcjtp.fsf@gnu.org> <87d06g6vsw.fsf@gmail.com> <834krscfa3.fsf@gnu.org> <87v9k76gq4.fsf@gmail.com> <83zh9jblqj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="69521"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: dfussner@googlemail.com, 41645@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 04 09:00:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jgjrJ-000I20-CA for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Jun 2020 09:00:13 +0200 Original-Received: from localhost ([::1]:38946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jgjrI-00075j-Dk for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 04 Jun 2020 03:00:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41810) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jgjr9-00075K-2X for bug-gnu-emacs@gnu.org; Thu, 04 Jun 2020 03:00:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33462) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jgjr8-00046s-8K for bug-gnu-emacs@gnu.org; Thu, 04 Jun 2020 03:00:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jgjr8-0008Hd-5V for bug-gnu-emacs@gnu.org; Thu, 04 Jun 2020 03:00:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Jun 2020 07:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41645 X-GNU-PR-Package: emacs Original-Received: via spool by 41645-submit@debbugs.gnu.org id=B41645.159125394331739 (code B ref 41645); Thu, 04 Jun 2020 07:00:02 +0000 Original-Received: (at 41645) by debbugs.gnu.org; 4 Jun 2020 06:59:03 +0000 Original-Received: from localhost ([127.0.0.1]:45007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgjqB-0008Fq-0N for submit@debbugs.gnu.org; Thu, 04 Jun 2020 02:59:03 -0400 Original-Received: from mail-wm1-f67.google.com ([209.85.128.67]:51694) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jgjq8-0008FI-B3 for 41645@debbugs.gnu.org; Thu, 04 Jun 2020 02:59:01 -0400 Original-Received: by mail-wm1-f67.google.com with SMTP id u13so4103302wml.1 for <41645@debbugs.gnu.org>; Wed, 03 Jun 2020 23:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=IBMcobOyo57Fo9TtDsOP9ADfU6iQprZY5KcmbLM0glk=; b=CSFhWVf/W7RjopZqVIlO8xzINsbSSqeDyrUfEtkWkLYT1RyjCGa4gVIpGpDjDaiREb SY3ODoH39iIoRfBCSXEQoeuuPiKC/2uqGDhEqUfz10LgOuum02ApIaWzGrxJ9ylr2rlc jynlDsWd1Y4lTZDMgK8EzX5NMRU84yWpg2+KujJiSryqdmAp9U+5qT7k7o3MNLMWR0w0 8CukvWCkIS6LlERyM5WdOvaGB3Ckk1BZjbSOAwAoVoul5QQzIUBOOfby2NhHV8nOmG51 zMa+MS2UE5NkYq2Mpg5ortPSCXAszcE6Dexp9AdiRV63Z8DHzfjHFI0FlIOYHrfqmROK fWvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=IBMcobOyo57Fo9TtDsOP9ADfU6iQprZY5KcmbLM0glk=; b=FNvrS5tEhTs19vO8WDx6wOICsu3ZD8yP3osVM3mRgo7tqXca0pKTSBoU9FMY3eBgmA k80nFPU7ofdUZ1bn/UUUvBrSreFt6YMl4msjwy3q2DRg+SfbfZQbbSSEZq2Jf2bzQVmg bSBBmpYdrvUrQ20C41XAJNp43vDJUew2a+k3Uu1ionA6fjIxNl06h9U5G+48Yi1MAktb Fc4Sdh0f2XyjrGALb1jVLN6P1FGb6/T1o5U7nwuo/acAD5OTSQ7vFbCb2G31l58yK2mi lyqY0etoNbVlMgmv9R4gBtUvxUz2l9RNn6dgCNfKZfgsvO1C7LaZxrILHfdh/rhmeWEM Wczg== X-Gm-Message-State: AOAM533qUatBvcPqXjvynbhtOMKiIGYeXcV6a4Uz+p3fr7orKBacW7k0 pXnnDpDD8YE/eQyGb/e0ZCVGzP8Kvxo= X-Google-Smtp-Source: ABdhPJxqSpN1cCKZhq4QaC4Z9tb57J39mZSeP38G+0jqBXaJtAYt/H3CPNtlIPlR8rjKozaJ6zIS2Q== X-Received: by 2002:a1c:1b13:: with SMTP id b19mr2520428wmb.84.1591253934100; Wed, 03 Jun 2020 23:58:54 -0700 (PDT) Original-Received: from chametz (tor-exit-13.zbau.f3netze.de. [185.220.100.240]) by smtp.gmail.com with ESMTPSA id 5sm8759062wrr.5.2020.06.03.23.58.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2020 23:58:53 -0700 (PDT) In-Reply-To: <83zh9jblqj.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 04 Jun 2020 05:36:36 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:181494 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Pip Cet >> 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? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Avoid-zero-width-glyphs-and-the-resulting-cursor-art.patch >From 6efd912c82be9c071f5a02eb67ffcc0d6b6ebc2e Mon Sep 17 00:00:00 2001 From: Pip Cet 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 --=-=-=--