From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#49797: 28.0.50; Setting face to custom fontset doesn't work Date: Wed, 6 Oct 2021 11:56:18 -0700 Message-ID: <219B3DA8-2E40-4BC1-8235-7330308F1737@gmail.com> 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> <83zgrm0zqt.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) 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="15333"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Kenichi Handa , 49797@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 06 21:01:28 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 1mYCAR-0003j6-21 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Oct 2021 21:01:27 +0200 Original-Received: from localhost ([::1]:42978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYCAP-0006kT-T1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 06 Oct 2021 15:01:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYC6A-0008Vc-MK for bug-gnu-emacs@gnu.org; Wed, 06 Oct 2021 14:57:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYC6A-0002sx-D4 for bug-gnu-emacs@gnu.org; Wed, 06 Oct 2021 14:57:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYC6A-0002P1-CC for bug-gnu-emacs@gnu.org; Wed, 06 Oct 2021 14:57:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 06 Oct 2021 18:57: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.16335465949190 (code B ref 49797); Wed, 06 Oct 2021 18:57:02 +0000 Original-Received: (at 49797) by debbugs.gnu.org; 6 Oct 2021 18:56:34 +0000 Original-Received: from localhost ([127.0.0.1]:45499 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYC5i-0002OA-Cj for submit@debbugs.gnu.org; Wed, 06 Oct 2021 14:56:34 -0400 Original-Received: from mail-qk1-f169.google.com ([209.85.222.169]:40718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYC5b-0002NS-Ef for 49797@debbugs.gnu.org; Wed, 06 Oct 2021 14:56:33 -0400 Original-Received: by mail-qk1-f169.google.com with SMTP id z40so2195417qko.7 for <49797@debbugs.gnu.org>; Wed, 06 Oct 2021 11:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=z7I0cs6su7CQTsDNU8UeyTaPxpzPf+fKSp97VH/BIZk=; b=ZTNMCelhvUefPjjDRCX9OH9+EEJGNGjcez5zmmPpGS/U7K8dZcm4anR2E0do+auDYI behefVvjfQ/QOunOipYI+Ml0mKpZFXI3eCjaSMfh5I+P/MeUZ3g6Xry8MsTL7Zt7Orjf JSWvFo3f2UomjC/1veu4cjklAOp41t0/M+yuA/NxpnmsXkiaMf510rj8H7nX3TxxS2an j+tOBF/rnQMAdfxAbhMrzWsHnj3mGvobnCZn9ezlau0DnCsyf/LJzK/H8BdFpS74VoSf M/vHpLmK+Gp3pIpyRaKci2itmUOQr9YLWibA6yXpSLpGOQue1HTO+ssy0I/nEqFhnYkc pWLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=z7I0cs6su7CQTsDNU8UeyTaPxpzPf+fKSp97VH/BIZk=; b=3teZnhPm6HAAL1/WImgLa1IWZKs8ZyTkQAgofehPC+yfSoOI1iE7CDPQUv3JEw/OLt CxpJqtKSoLsRok9bREHLQ5Cgb96EqNPFs6N9/GIfDFR1m+60s9BH85kS17aMcp3Wlhrb R0q5beg8Z+VlBnrfVYKiZmoixawd0prOGahMiIuWd+h+YdOSJB5LG9rQdmPZ+UpCrxyM 5aKWajbnulz2zB/cHJos8nI0Il7IJztiePCVjVvjlPXvmTyxCkv6x/eEl+wo+EW5I574 ShYRi8yAGnTK9pIBuobNA+Vi97e45B06cMbBZl9vLgJsh80lTMc0MQn22F+oZ+VTuhBz /MHQ== X-Gm-Message-State: AOAM531m2eNHYOi4lYrQuEev1LI8/LzEFwgdmGFS2z/kxGO4TUj8OaST fjKRgEB3XgDOgOokqR4MttO3YlJ2AGs= X-Google-Smtp-Source: ABdhPJxo28XMuJwkdI8leaz9llok5HrQmzRCUuMTBGGuq36pMp0H2Oh3hQP+m13tfzPc2Pex279ELw== X-Received: by 2002:a37:901:: with SMTP id 1mr336994qkj.342.1633546581564; Wed, 06 Oct 2021 11:56:21 -0700 (PDT) Original-Received: from smtpclient.apple ([2600:1700:2ec7:8c9f:9d7b:4ef2:efed:f945]) by smtp.gmail.com with ESMTPSA id p17sm15551980qtl.52.2021.10.06.11.56.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Oct 2021 11:56:20 -0700 (PDT) In-Reply-To: <83zgrm0zqt.fsf@gnu.org> X-Mailer: Apple Mail (2.3654.120.0.1.13) 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:216584 Archived-At: > On Oct 6, 2021, at 11:33 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Wed, 6 Oct 2021 11:11:42 -0700 >> Cc: Kenichi Handa , >> 49797@debbugs.gnu.org >>=20 >> Later in that function, we take the fontset of that face >>=20 >> fontset =3D FONTSET_FROM_ID (face->fontset); >>=20 >> Then find an appropriate font from it >>=20 >> rfont_def =3D fontset_font (fontset, c, face, id); >=20 > 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. That is not, the part you mentioned is before: if (face->ascii_face->font) { XSETFONT (font_object, face->ascii_face->font); if (font_has_char (f, font_object, c)) return face->ascii_face->id; } And what about the comment I mentioned? Did you read it? In any case,=20 rfont_def =3D fontset_font (fontset, c, face, id);=20 finds a font in the fontset that can display character c. That=E2=80=99s = hard to ignore. >=20 >> 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): >>=20 >> (set-face-attribute 'variable-pitch :fontset = "fontset-serif=E2=80=9D) >>=20 >> (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 = =E2=80=9Cfontset-serif=E2=80=9D. The only problem is 1) :fontset = attribute is not documented and 2) this doesn=E2=80=99t work with = =E2=80=98default face. >=20 > As mentioned earlier, user code is not supposed to set the :fontset > attribute directly, which is why it isn't documented. Finternal_set_lisp_face_attribute has code that let me set :fontset. Why = is it there if Lisp is not supposed to set :fontset? Plus, Emacs = doesn=E2=80=99t set :fontset by itself, what=E2=80=99s the point for = this attribute, then, if Emacs doesn=E2=80=99t set it itself and don=E2=80= =99t want the user to set it? >=20 >>> 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. >>=20 >> Emacs already has an elaborate implementation to support fontsets >=20 > Not fontsets specific to faces, according to my reading of the code, > as I tried to explain. >=20 >> it is just hindered by the manual and bugs in the Lisp interface. >=20 > Or maybe by design. >=20 >>> 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. >>=20 >> 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 =E2=80=98default face = doesn=E2=80=99t work. >=20 > I'm saying that fixing this will probably need more extensive changes > than in your proposed patch. I don=E2=80=99t think so. Anyway, you don=E2=80=99t seem convinced = albeit clear evidences in my eye. Let=E2=80=99s wait for Handa-san to = enlighten us. Yuan