all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: handa@gnu.org, 49797@debbugs.gnu.org
Subject: bug#49797: 28.0.50; Setting face to custom fontset doesn't work
Date: Wed, 06 Oct 2021 21:33:46 +0300	[thread overview]
Message-ID: <83zgrm0zqt.fsf@gnu.org> (raw)
In-Reply-To: <890ABB11-65A7-4F52-8816-7FA90BED7961@gmail.com> (message from Yuan Fu on Wed, 6 Oct 2021 11:11:42 -0700)

> From: Yuan Fu <casouri@gmail.com>
> Date: Wed, 6 Oct 2021 11:11:42 -0700
> Cc: Kenichi Handa <handa@gnu.org>,
>  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.





  reply	other threads:[~2021-10-06 18:33 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-31 21:37 bug#49797: 28.0.50; Setting face to custom fontset doesn't work Yuan Fu
2021-08-01  6:03 ` Eli Zaretskii
2021-08-01 15:18   ` Yuan Fu
2021-08-01 16:01     ` Eli Zaretskii
2021-08-01 16:27       ` Yuan Fu
2021-08-01 16:42         ` Eli Zaretskii
2021-08-02 11:57   ` handa
2021-08-02 17:14     ` Fu Yuan
2021-10-05 15:36       ` Yuan Fu
2021-10-05 16:12         ` Eli Zaretskii
2021-10-05 17:31           ` Yuan Fu
2021-10-05 19:01             ` Eli Zaretskii
2021-10-05 19:15               ` Yuan Fu
2021-10-05 19:18                 ` Eli Zaretskii
2021-10-05 19:26             ` Eli Zaretskii
2021-10-05 20:51               ` Yuan Fu
2021-10-06 16:10                 ` Eli Zaretskii
2021-10-06 18:11                   ` Yuan Fu
2021-10-06 18:33                     ` Eli Zaretskii [this message]
2021-10-06 18:56                       ` Yuan Fu
2021-10-06 19:02                         ` Eli Zaretskii
2021-10-07 20:13                           ` Yuan Fu
2021-10-08  5:38                             ` Eli Zaretskii
2021-10-08 19:35                               ` Yuan Fu
2022-08-22 10:35                                 ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83zgrm0zqt.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=49797@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=handa@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.