bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#49797: 28.0.50; Setting face to custom fontset doesn't work


From: Eli Zaretskii
Subject: bug#49797: 28.0.50; Setting face to custom fontset doesn't work
Date: Wed, 06 Oct 2021 21:33:46 +0300

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]