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

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

bug#54646: 29.0.50; set-fontset-font and font clipping issues


From: Visuwesh
Subject: bug#54646: 29.0.50; set-fontset-font and font clipping issues
Date: Sun, 03 Apr 2022 15:56:35 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

[Sunday April 03, 2022] Eli Zaretskii wrote:

>> From: Visuwesh <visuweshm@gmail.com>
>> Cc: rpluim@gmail.com,  54646@debbugs.gnu.org
>> Date: Sun, 03 Apr 2022 14:45:35 +0530
>> 
>> > It's hard to understand what you printed out, or where is the
>> > difference.  It is best to print only the data for the characters for
>> > which you see display problems, because all the rest is just clutter.
>> > And in any case, please print the character with the data, otherwise
>> > it is impossible to know what to compare.
>> 
>> I used the %c printf format control to print the character in
>> question---chars[char_idx].  comment-section-good is the "good" case and
>> comment-section-bad is the "bad" case.  The URL I browsed in eww is
>> https://www.dinamalar.com/news_detail.asp?id=2998931 (isearch for
>> "Suppon" to get to the comment section).  Unfortunately, all the
>> characters are in raw bytes so if there's a better to print the
>> characters, please let me know.
>
> The %c format is only good for single-byte characters, which these
> ones aren't.  Please use %x to print them (in hex).
>

Will do, thanks.

> Also, I think printing everything is too much, and doesn't allow to
> focus.  Please print only when the character's code is one of those
> involved in the problematic display.

Unfortunately, the characters that are problematic tend to differ from
each run.  Nevertheless, I will hand-pick the problematic characters and
send it.

>  "C-u C-x =" will tell you the codepoints of the characters involved:
> the one that is displayed incorrectly and the ones surrounding it:
> please add an 'if' clause there which would only print the metrics
> data for the characters in which we are interested.  Something like
> this:
>
>   if (chars[char_idx] == CHAR1
>       || chars[char_idx] == CHAR2
>       || chars[char_idx] == CHAR3)
>     printf (...
>
> where CHAR1, CHAR2, and CHAR3 are the characters involved in the
> problematic display, according to "C-u C-x =".
>
> May I suggest that you show me the code you add to hbfont.c before you
> run it?  This would avoid unnecessary iterations for you.
>

Sure,

diff --git a/src/hbfont.c b/src/hbfont.c
index 2721a66120..ad6838b19a 100644
--- a/src/hbfont.c
+++ b/src/hbfont.c
@@ -490,6 +490,7 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction)
     : NULL;
   if (!hb_font)
     return make_fixnum (0);
+  printf("position_unit begin_hb_font: %f\n", position_unit);
 
   hb_bool_t success = hb_shape_full (hb_font, hb_buffer, NULL, 0, NULL);
   if (font->driver->end_hb_font)
@@ -589,10 +590,15 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direction)
       LGLYPH_SET_RBEARING (lglyph, metrics.rbearing);
       LGLYPH_SET_ASCENT (lglyph, metrics.ascent);
       LGLYPH_SET_DESCENT (lglyph, metrics.descent);
+      printf("lbearing %d rbearing %d width %d ascent %d descent %d\n",
+            metrics.lbearing, metrics.rbearing, metrics.width, metrics.ascent, 
metrics.descent);
 
       xoff = lround (pos[i].x_offset * position_unit);
       yoff = - lround (pos[i].y_offset * position_unit);
       wadjust = lround (pos[i].x_advance * position_unit);
+      printf("char %x xadvance %d yadvance %d xoffset %d yoffset %d\n",
+            chars[char_idx], pos[i].x_advance, pos[i].y_advance, 
pos[i].x_offset, pos[i].y_offset);
+      printf("xpos %d yoff %d wadjust %d\n", xoff, yoff, wadjust);
       if (xoff || yoff || wadjust != metrics.width)
        LGLYPH_SET_ADJUSTMENT (lglyph, CALLN (Fvector,
                                              make_fixnum (xoff),


> Thanks.





reply via email to

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