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: Sun, 03 Apr 2022 15:56:35 +0530 Message-ID: <87zgl2cvj8.fsf@gmail.com> References: <875ynuokqt.fsf@gmail.com> <83lewq7g1j.fsf@gnu.org> <87czi27bnu.fsf@gmail.com> <83h77e7as6.fsf@gnu.org> <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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33750"; 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 Sun Apr 03 12:28:24 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 1naxT5-0008b3-QM for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Apr 2022 12:28:23 +0200 Original-Received: from localhost ([::1]:50324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naxT4-0007j3-Oy for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 03 Apr 2022 06:28:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:42474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naxSk-0007iu-AM for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2022 06:28:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53740) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naxSk-0005Ti-1b for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2022 06:28:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naxSj-0003zm-Py for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2022 06:28:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Apr 2022 10:28: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.164898162815297 (code B ref 54646); Sun, 03 Apr 2022 10:28:01 +0000 Original-Received: (at 54646) by debbugs.gnu.org; 3 Apr 2022 10:27:08 +0000 Original-Received: from localhost ([127.0.0.1]:47637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naxRr-0003yf-RC for submit@debbugs.gnu.org; Sun, 03 Apr 2022 06:27:08 -0400 Original-Received: from mail-pj1-f66.google.com ([209.85.216.66]:41548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naxRq-0003y3-N3 for 54646@debbugs.gnu.org; Sun, 03 Apr 2022 06:27:07 -0400 Original-Received: by mail-pj1-f66.google.com with SMTP id l4-20020a17090a49c400b001c6840df4a3so6458760pjm.0 for <54646@debbugs.gnu.org>; Sun, 03 Apr 2022 03:27:06 -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; bh=kQfmo6j21vKQpf0DqTcZav/0p4NsdUAalX72rJAxknA=; b=DE/ZwLPJOD6nNoXWOZ3rwZR56gp55sMyVD3t4cIRu3o1aB6GkpuqraipJOI/RZnoUu /TiTHfmnVW0ywjz++8kdOgDxeWPzRTtJK/Fyhdv44q8HMla0cjL0rIeeK7mcvZLESbin /sDmlaIBGtgZiXk5/kVPpuyQqb7eip2Lr5QQPtnl3D1cHycehemvG/DBx0T7kht5A8uB nVUqz+PssIdPaMLpZIMYF4DOHFXuOiBOXgGoIRoQGdXT5wpxO8aphtUS2Ow20YD8zOzy AQWT02DIYfruTTq0bEu2U8JIcp5BfKBwIYSpF83cWtaAMWWrTN5d1uU91Kf2fylkwwpU NOmw== 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; bh=kQfmo6j21vKQpf0DqTcZav/0p4NsdUAalX72rJAxknA=; b=pe0+IRvJO0mdD/yL79JGi0Cjro0YCQmFDY2NpLV63cKhThJbsYI5V+j3rlhNSFqkDJ SpmeZJ4FdrPbeqeF75wWZCvo1q+46bds4/Rl+5wG1PPWMEMRElHDm4k+CMO5N7J1UlL3 LXhJDWSuxGbXAP6lbIs0/ncS5J4mDCWb1DsRkxjYR+u15egpVsSyzQGItEWKqKW90Vzm GH9PfChUaIdE9oEAq087P891rYhM5WhSrPluQ+sBEQQ6R6IDu3C4gzkGXI5bJjlQWu/t OK3tF8SUcit78oQl6TptKwK7edYRlTtRJzZQedcnZTIQbP+G/oZTLj7tuCl30s86ijRD cl2g== X-Gm-Message-State: AOAM532GF14xqYnbuBIKdLzTd/LfRitXFai7UZt/mDN2uNY/vZ+q4zLr dOk8l8BL+pwwuK36JC8xiok= X-Google-Smtp-Source: ABdhPJz8GfIDuFe6yh8upL7plQ/4KzXz6lB7iB/8773z3+BK7gMGGtK5ul+icRbhlOEEx2zM5eoJ1A== X-Received: by 2002:a17:902:d884:b0:153:ce8e:66fe with SMTP id b4-20020a170902d88400b00153ce8e66femr18188440plz.157.1648981620674; Sun, 03 Apr 2022 03:27:00 -0700 (PDT) Original-Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id h13-20020a056a00170d00b004fb1450229bsm9253043pfc.16.2022.04.03.03.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Apr 2022 03:27:00 -0700 (PDT) In-Reply-To: <83y20m32h2.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 03 Apr 2022 13:06:49 +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:229323 Archived-At: [Sunday April 03, 2022] Eli Zaretskii wrote: >> From: Visuwesh >> 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.