bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41645: 27.0.91; Combining Grapheme Joiner (#x34f) gui artifacts


From: Pip Cet
Subject: bug#41645: 27.0.91; Combining Grapheme Joiner (#x34f) gui artifacts
Date: Wed, 03 Jun 2020 20:23:47 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

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 14:58:07 +0000
>> 
>> > I'm not sure I follow.  What do you mean by "reject"?  I thought the
>> > code which ignores the metric and sets the font_not_found_p flag when
>> > we get a zero-width glyph is a kind of "rejection".
>> 
>> I mean "treat the glyph as non-existent". Currently, for (3), glyphs
>> with lbearing but no pixel width are treated as valid and expanded to
>> cover a single pixel, which is all but invisible on my screen.
>
> They are hard to spot, but if one looks close enough, IME they are
> visible.
>
> We could perhaps introduce a feature whereby such thin-space glyphs
> are somehow made to stand out more, but that would be a separate
> feature, because right now we have these 1-pixel thin spaces with many
> control characters.

Yes, you're right.

>
>> > If you disable auto-composition-mode, and use the
>> > fonts which shows CGJ as zero-width glyph, do you still see display
>> > artifacts?
>> 
>> No.
>
> Then I think your suggestion to handle such lgstrings as we do with
> simple characters is sufficient to fix situations such as this one.

Okay.  How's this patch?

>From 1b8683cb24ba364475c864f708da7b32319fdd2e Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
Date: Wed, 3 Jun 2020 20:10:51 +0000
Subject: [PATCH] Avoid zero-width glyphs and the resulting cursor artifacts.

* src/xdisp.c (gui_produce_glyphs): Widen zero-width compositions to
one pixel.  (Bug#41645)
---
 src/xdisp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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;
-- 
2.27.0.rc0

>> > If not, what do you see and why is this kind of
>> > 'rejection" not enough?
>> 
>> CGJ is displayed as a black box as wide as a space, which is perfectly
>> fine. It's U+301 that's not.
>
> Hmm... how does U+301 enter this picture?  What problems do you see
> with its display?

It's a single pixel in width and leaves the accent slightly off-center
as a result. Nothing major.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]