From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#54646: 29.0.50; set-fontset-font and font clipping issues Date: Thu, 21 Apr 2022 20:20:45 +0530 Message-ID: <87wnfitrqy.fsf@gmail.com> References: <875ynuokqt.fsf@gmail.com> <874k3e79mc.fsf@gmail.com> <83fsmy793g.fsf@gnu.org> <87v8vu5j9k.fsf@gmail.com> <837d8a6wm7.fsf@gnu.org> <87lewqjh41.fsf@gmail.com> <83wnga5ap3.fsf@gnu.org> <87a6d69g46.fsf@gmail.com> <87h77dk3zn.fsf@gmail.com> <87a6d5jyat.fsf@gmail.com> <87wng989ym.fsf@gmail.com> <83ilrt5b1v.fsf@gnu.org> <87h77cetq9.fsf@gmail.com> <831qyg6cyt.fsf@gnu.org> <87czi0eoyx.fsf@gmail.com> <83wng84rf8.fsf@gnu.org> <874k3aede0.fsf@gmail.com> <83y20m32h2.fsf@gnu.org> <87zgl2cvj8.fsf@gmail.com> <83wng630fg.fsf@gnu.org> <87v8vqcthz.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1094"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: rpluim@gmail.com, 54646@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 21 16:52:13 2022 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 1nhYAG-000AY9-Ki for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Apr 2022 16:52:12 +0200 Original-Received: from localhost ([::1]:47302 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nhYAF-0004KI-5z for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Apr 2022 10:52:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nhYA6-0004Is-I3 for bug-gnu-emacs@gnu.org; Thu, 21 Apr 2022 10:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nhYA6-0007c8-6r for bug-gnu-emacs@gnu.org; Thu, 21 Apr 2022 10:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nhYA6-0006Ab-1W for bug-gnu-emacs@gnu.org; Thu, 21 Apr 2022 10:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Apr 2022 14:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54646 X-GNU-PR-Package: emacs Original-Received: via spool by 54646-submit@debbugs.gnu.org id=B54646.165055267823653 (code B ref 54646); Thu, 21 Apr 2022 14:52:01 +0000 Original-Received: (at 54646) by debbugs.gnu.org; 21 Apr 2022 14:51:18 +0000 Original-Received: from localhost ([127.0.0.1]:50592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nhY9N-00069Q-KI for submit@debbugs.gnu.org; Thu, 21 Apr 2022 10:51:17 -0400 Original-Received: from mail-pj1-f68.google.com ([209.85.216.68]:41917) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nhY9L-000695-7z for 54646@debbugs.gnu.org; Thu, 21 Apr 2022 10:51:15 -0400 Original-Received: by mail-pj1-f68.google.com with SMTP id z5-20020a17090a468500b001d2bc2743c4so5431704pjf.0 for <54646@debbugs.gnu.org>; Thu, 21 Apr 2022 07:51:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=0Q93tOxxVykxGMIh6wnndISYPod+5hZ5YmUcYE52s2g=; b=Hx0YAcTW/fGDrJe4w2fPx9ro/FsxWAYf+wLq5+rPP6Za7R3u9szm9eNySCt4vWQS7i Zv6T1/Kwoee45AZ9RI78IbyVzWlJGbI5a9F0fGbuqFfK4UtEGVLQjRRFtv1lpnsvsoly DbqMbKaRZfq9q6sADPMwWf9kpWqNOONPCgPDsLJArdh3rznD4yovwePhhN6eUCfk//iS 9LlQi+6I/Bf+0eDTXYGH9pOtW+ezcEFtGTL7aqPVYOwWYBZSd6ALC/a/sdRxasHFPeBJ k1pkgdpsBSxB9gqU3rooADSpiWsKSO4ZBdVd8MfTcUVEAnh+PGEvDHS5941LwoY7uoJu /HOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=0Q93tOxxVykxGMIh6wnndISYPod+5hZ5YmUcYE52s2g=; b=Y2SwcVXBFWEbVa+OiMJIEjxYv2qktx8N55DibJFGw5FnWcDI4cAWDmTuBnHCsfnzmn e+Fihty4wxU42YnmTXsJ2oYkYOXMhBrHyhCBC3jHE8Jb2iQCfrvAkwthH+TKkhbR98WP np/P7OGIfbSdafMgn6EJ3SnnxIzoxIioouia8lMGWWBBpjc5rbXAxdNJXJf8Q2jku3nB Gf1CJD6iREiFmMYIEnBLTn7OOvsgh4Qli/D9M++7/l2iSpBk18xeI87O2bFD1zNLhiX6 7C0t7fSDz1NyMshkM6mptWmKXkK8/wgsm6vd68DdbLQRI725d4UUA38CPV7trpmpEIx7 MqHg== X-Gm-Message-State: AOAM531ZWtKeV6ngcxv2I//Tyh/T8C/5v3gTcA++h9aRRJ1MXhvtI6AA dW3A+U2AZ5ZM/q6FR2dRiv0= X-Google-Smtp-Source: ABdhPJyZGIXQhYu+Bd5yXCzAFTnfYxiWombvXHW1K0Y3cfzGoLlHYPLdEoHbzo0bxYQobo6B1E+YVA== X-Received: by 2002:a17:902:7c81:b0:156:30ef:7dec with SMTP id y1-20020a1709027c8100b0015630ef7decmr25889456pll.74.1650552669166; Thu, 21 Apr 2022 07:51:09 -0700 (PDT) Original-Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id b6-20020a17090a550600b001cd4989ff48sm2998712pji.15.2022.04.21.07.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 07:51:08 -0700 (PDT) In-Reply-To: <87v8vqcthz.fsf@gmail.com> (Visuwesh's message of "Sun, 03 Apr 2022 16:40:32 +0530") 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:230376 Archived-At: [=E0=AE=9E=E0=AE=BE=E0=AE=AF=E0=AE=BF=E0=AE=B1=E0=AF=81 =E0=AE=8F=E0=AE=AA= =E0=AF=8D=E0=AE=B0=E0=AE=B2=E0=AF=8D 03, 2022] Visuwesh wrote: > [Sunday April 03, 2022] Eli Zaretskii wrote: > >>> From: Visuwesh >>> Cc: rpluim@gmail.com, 54646@debbugs.gnu.org >>> Date: Sun, 03 Apr 2022 15:56:35 +0530 >>>=20 >>> > The %c format is only good for single-byte characters, which these >>> > ones aren't. Please use %x to print them (in hex). >>> > >>>=20 >>> Will do, thanks. >>>=20 >>> > 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. >>>=20 >>> Unfortunately, the characters that are problematic tend to differ from >>> each run. Nevertheless, I will hand-pick the problematic characters and >>> send it. >> >> That'd be good. We need a reproducible case to work with. >> >>> > if (chars[char_idx] =3D=3D CHAR1 >>> > || chars[char_idx] =3D=3D CHAR2 >>> > || chars[char_idx] =3D=3D CHAR3) >>> > printf (... >>> > >>> > where CHAR1, CHAR2, and CHAR3 are the characters involved in the >>> > problematic display, according to "C-u C-x =3D". >>> > >>> > 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. >>> > >>>=20 >>> Sure, >> >> This is okay, but please don't forget to add that 'if' condition. I >> think the characters involved in the composition, and in addition one >> character on each side of those, should be enough. > > It seems like I did not get my point across: the characters that tend > to be rendered problematic differ from each run so I will hand-pick the > data for the problematic characters in _that_ run and send it. > >> >> Please show the final code, so that I could then interpret the >> print-outs correctly. >> >> Thanks. > > Considering the above, it would be > > [....] It took me eons to do this again, I apologise for that. There's one thing that I noticed about this issue: when I use this webpage https://www.dinamalar.com/news_detail.asp?id=3D3012739 as a test page and I let _all_ the scaled characters in that page be displayed, I cannot reproduce the issue but if I let only some of the scaled characters in that page be displayed and go to a part that was never displayed before, the characters there have the "bad" shaping. I'm writing this here in the hopes that it might help in debugging. I was not successful in getting the data for all offending sequences. The offending sequences were, bb9 bbf -- =E0=AE=B9=E0=AE=BF ba9 bc1 -- =E0=AE=A9=E0=AF=81 bb5 bbf -- =E0=AE=B5=E0=AE=BF b86 -- =E0=AE=86 and the GOOD case for bb9 bbf is lbearing 1 rbearing 28 width 28 ascent 9 descent 5 1 bb9 bbf xadvance 1809 yadvance 0 xoffset 0 yoffset 0 xpos 0 yoff 0 wadjust 28 and the BAD case is lbearing 1 rbearing 28 width 28 ascent 9 descent 5 1 bb9 bbf xadvance 3193 yadvance 0 xoffset 0 yoffset 0 xpos 0 yoff 0 wadjust 50 If you want more data, then I can try repeating this (I did not retry since it is really tedious). The data is for -Goss-Kurinto Seri-regular-normal-normal-*-17-*-*-*-*-0-iso= 10646-1 and HarfBuzz version is still at 4.2.0. The patch I used is diff --git a/src/hbfont.c b/src/hbfont.c index 2721a66120..9432f75bbf 100644 --- a/src/hbfont.c +++ b/src/hbfont.c @@ -490,6 +490,7 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object directi= on) : NULL; if (!hb_font) return make_fixnum (0); + printf("position_unit begin_hb_font: %f\n", position_unit); =20 hb_bool_t success =3D hb_shape_full (hb_font, hb_buffer, NULL, 0, NULL); if (font->driver->end_hb_font) @@ -589,10 +590,17 @@ hbfont_shape (Lisp_Object lgstring, Lisp_Object direc= tion) 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, m= etrics.descent); =20 xoff =3D lround (pos[i].x_offset * position_unit); yoff =3D - lround (pos[i].y_offset * position_unit); wadjust =3D lround (pos[i].x_advance * position_unit); + printf("%x %x %x xadvance %d yadvance %d xoffset %d yoffset %d\n", + (char_idx =3D=3D 0 ? 1 : chars[char_idx-1]), chars[char_idx], + (char_idx =3D=3D glyph_len-1 ? 1 : chars[char_idx+1]), + 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 !=3D metrics.width) LGLYPH_SET_ADJUSTMENT (lglyph, CALLN (Fvector, make_fixnum (xoff),