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: Thu, 04 Jun 2020 06:58: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 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?


>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


reply via email to

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