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: Wed, 06 Oct 2021 21:33:46 +0300 Message-ID: <83zgrm0zqt.fsf@gnu.org> References: <87y29k2h4z.fsf@gnu.org> <3B853424-9F63-4A6B-B7A9-2E3AB71986AC@gmail.com> <835yub4fj5.fsf@gnu.org> <8FD18262-3F40-4033-A49D-F6CEA89A3A31@gmail.com> <83sfxf2ry5.fsf@gnu.org> <1AF30098-F55E-48A7-A0D4-E529DFBA6895@gmail.com> <838rz62kx8.fsf@gnu.org> <890ABB11-65A7-4F52-8816-7FA90BED7961@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="525"; 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 Wed Oct 06 20:34:09 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 1mYBk1-000AWE-9v for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Oct 2021 20:34:09 +0200 Original-Received: from localhost ([::1]:43012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYBk0-0003TT-1v for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Oct 2021 14:34:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYBjv-0003TL-0M for bug-gnu-emacs@gnu.org; Wed, 06 Oct 2021 14:34:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33928) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYBju-0002u5-P5 for bug-gnu-emacs@gnu.org; Wed, 06 Oct 2021 14:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYBju-0001nV-HE for bug-gnu-emacs@gnu.org; Wed, 06 Oct 2021 14:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Oct 2021 18:34:02 +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.16335452406901 (code B ref 49797); Wed, 06 Oct 2021 18:34:02 +0000 Original-Received: (at 49797) by debbugs.gnu.org; 6 Oct 2021 18:34:00 +0000 Original-Received: from localhost ([127.0.0.1]:45474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYBjs-0001nE-0f for submit@debbugs.gnu.org; Wed, 06 Oct 2021 14:34:00 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:34132) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYBjp-0001n2-OV for 49797@debbugs.gnu.org; Wed, 06 Oct 2021 14:33:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:36482) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYBjk-0002l3-IE; Wed, 06 Oct 2021 14:33:52 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:4522 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 1mYBjk-0008Gl-4W; Wed, 06 Oct 2021 14:33:52 -0400 In-Reply-To: <890ABB11-65A7-4F52-8816-7FA90BED7961@gmail.com> (message from Yuan Fu on Wed, 6 Oct 2021 11:11:42 -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:216582 Archived-At: > From: Yuan Fu > Date: Wed, 6 Oct 2021 11:11:42 -0700 > Cc: Kenichi Handa , > 49797@debbugs.gnu.org > > Later in that function, we take the fontset of that face > > fontset = FONTSET_FROM_ID (face->fontset); > > Then find an appropriate font from it > > rfont_def = fontset_font (fontset, c, face, id); Yes, AFAIU that's the part where we check if the current face's fontset's font, made for the ASCII characters, happens to have a glyph for the non-ASCII character we need to display. > So Emacs definitely is designed to support using fontsets to assign different fonts for different characters to faces. In fact, you can try this right now (without my patch): > > (set-face-attribute 'variable-pitch :fontset "fontset-serif”) > > (Notice I used the :fontset attribute, not :font attribute.) And the variable-pitch face will work as intended, use CJK font for CJK characters and Latin font for Latin characters, specified in “fontset-serif”. The only problem is 1) :fontset attribute is not documented and 2) this doesn’t work with ‘default face. As mentioned earlier, user code is not supposed to set the :fontset attribute directly, which is why it isn't documented. > > Maybe we can extend the design to support "face-specific" fontsets, > > but I'm quite sure that will need changes in font.c and fontset.c as > > well, because the current design is implicitly assumed there. > > Emacs already has an elaborate implementation to support fontsets Not fontsets specific to faces, according to my reading of the code, as I tried to explain. > it is just hindered by the manual and bugs in the Lisp interface. Or maybe by design. > > That's one way of interpreting what the manual says, but it is not the > > only one. If you look at what the code does, you will arrive at > > another interpretation: Emacs allows you to specify a fontset as the > > value for the :font attribute, but what it does in that case is take > > from the fontset the font for ASCII characters, and then use it as if > > you specified that font, not a fontset. IOW, the fontset in that case > > is just used as a method of specifying the ASCII font. > > I agree, another way is to document the :fontset attribute, document that passing a fontset to :font attribute only sets the ASCII font, and fix the bug where setting :fontset attribute for ‘default face doesn’t work. I'm saying that fixing this will probably need more extensive changes than in your proposed patch.