From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#49797: 28.0.50; Setting face to custom fontset doesn't work Date: Tue, 05 Oct 2021 19:12:14 +0300 Message-ID: <835yub4fj5.fsf@gnu.org> References: <87y29k2h4z.fsf@gnu.org> <3B853424-9F63-4A6B-B7A9-2E3AB71986AC@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5016"; mail-complaints-to="usenet@ciao.gmane.io" Cc: handa@gnu.org, 49797@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 05 19:16:31 2021 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 1mXo3L-0001A9-9C for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 19:16:31 +0200 Original-Received: from localhost ([::1]:39118 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXo3J-0003pU-Bj for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 13:16:29 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXn3u-0002Fe-J0 for bug-gnu-emacs@gnu.org; Tue, 05 Oct 2021 12:13:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXn3t-0005wB-Rx for bug-gnu-emacs@gnu.org; Tue, 05 Oct 2021 12:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mXn3t-0007Ko-Ld for bug-gnu-emacs@gnu.org; Tue, 05 Oct 2021 12:13:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 05 Oct 2021 16:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49797 X-GNU-PR-Package: emacs Original-Received: via spool by 49797-submit@debbugs.gnu.org id=B49797.163345035728164 (code B ref 49797); Tue, 05 Oct 2021 16:13:01 +0000 Original-Received: (at 49797) by debbugs.gnu.org; 5 Oct 2021 16:12:37 +0000 Original-Received: from localhost ([127.0.0.1]:41701 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXn3T-0007KA-6A for submit@debbugs.gnu.org; Tue, 05 Oct 2021 12:12:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:44968) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mXn3N-0007Jt-Km for 49797@debbugs.gnu.org; Tue, 05 Oct 2021 12:12:34 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:45146) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXn3I-0005Pq-Eg; Tue, 05 Oct 2021 12:12:24 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:2708 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXn3H-0006ww-39; Tue, 05 Oct 2021 12:12:23 -0400 In-Reply-To: <3B853424-9F63-4A6B-B7A9-2E3AB71986AC@gmail.com> (message from Yuan Fu on Tue, 5 Oct 2021 08:36:26 -0700) 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:216471 Archived-At: > From: Yuan Fu > Date: Tue, 5 Oct 2021 08:36:26 -0700 > Cc: Eli Zaretskii , > 49797@debbugs.gnu.org > > I finally got myself a Linux machine and am able to use gdb and poke around in xfaces.c. I think the reason why setting custom fontset doesn’t work is at here, in Finternal_set_lisp_face_attribute at xfaces.c:3425: > > if (STRINGP (value)) > { > Lisp_Object name = value; > int fontset = fs_query_fontset (name, 0); > > if (fontset >= 0) > name = fontset_ascii (fontset); > value = font_spec_from_name (name); > if (!FONTP (value)) > signal_error ("Invalid font name", name); > } > else > signal_error ("Invalid font or font-spec", value); > > Basically, if I try to set a custom fontset to the :font attribute, Emacs takes the ASCII font from my custom fontset, and set the :font attribute to that ASCII font. Then if the face is the default face, in set_font_frame_param, Emacs translates the font attribute to the frame’s “font" parameter. Finally in gui_set_font, Emacs looks at the “font” frame parameter and sets frame’s font. > > If I try to set :fontset attribute for ‘default, Finternal_set_lisp_face_attribute works just fine, setting the fontset attribute in the face, but set_font_frame_param completely ignores the fontset attribute, still setting the “font” frame parameter with the :font attribute, and gui_set_font uses the “font” frame parameter . That’s why setting :fontset takes no effect either. > > For faces other than default, setting :fontset works fine, because realize_gui_face handles :fontset attribute correctly. But it doesn’t handle the case where the :font attribute contains a fontset. It works right now because Finternal_set_lisp_face always converts the fontset passed to :font attribute to an font (as described above). > > Here is my attempt to fix it: I don't think I have a clear understanding of the problem you are trying to solve, since 2 months passed since we last talked about this. First, Handa-san asked to try a slightly different setting; I'm not sure I understand whether you did and if so, what were the results. I also don't understand if the analysis of the code above is for the original test case or the one suggested by Handa-san. I'd like to see the latter. Next, you define a fontset for the 'latin' script, but that script includes the ASCII characters, and AFAIR Emacs generally ignores such settings, using the default font instead. Did you try the same with a script that doesn't include ASCII? And finally, even if all of the above isn't relevant or doesn't work, what real-life problem do you want to solve that cannot be solved by some other setting? Why use fontsets to define a font for the default face? The font selection and the fontset code in Emacs is not understood well enough by the current active maintainers, so making non-trivial changes there might risk breaking important use cases, and we will be unable to catch that in time because we are not familiar with the code. So unless you have a grave problem that has no other good solution, I'd prefer not to make changes in this stuff. That said, if Handa-san reviews the change and thinks it's a good idea, I will withdraw my objections. Thanks.