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: Yuan Fu
Subject: bug#49797: 28.0.50; Setting face to custom fontset doesn't work
Date: Tue, 5 Oct 2021 10:31:59 -0700


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.

Basically, Emacs doesn’t do what it claims to do in the manual, see below for more explanation.


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.

I have indeed tried and it didn’t work, maybe you missed that message. Handa-san suggests me to try setting :font attribute rather than :fontset. The test code uses what he suggests: using :font attribute.


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?

I have, and it doesn’t work. But that’s not really the point, I’ll explain further below.


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?

I just want to use different CJK fonts for different faces. The use case for me is this: I want to create two fontsets, “fontset-serif” and “fontset-mono”. And I assign serif CJK and Latin fonts to “fontset-serif”, monospace CJK and Latin fonts to “fontset-mono”. Then, I assign “fontset-serif” to variable-pitch face, and “fontset-mono” to default face. This allows me to use different CJK fonts in variable-pitch face and default face, just like I have different Latin fonts for variable-pitch and default face.

The situation now is that, if I assign “fontset-serif” to variable-pitch face, Emacs strips my CJK font (and any other non-ASCII font, for that matter), turns the fontset into an ASCII font, and only sets :font attribute with that ASCII font for variable-pitch face. Effectively, I can only use one CJK font for all the faces, namely the CJK font in the default fontset.

I think you would agree that, for non-Latin speakers, using different fonts for different faces (for non-Latin) characters is an important feature. Further more, this feature is clearly documented in the manual, but doesn’t work in reality.


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.

I understand, that’s why I tried to make minimal modification to the existing code. I hope by now I’ve convinced you that the feature I’m trying to fix is significant/useful enough. Not only is it useful, it (fontset) is already implemented, only hindered by a few bugs in the interface that prohibits anyone to make good use of it. 

However, I would be lying if I say there is no other solution—there is one, but it is far from a good solution. Basically, if I set the undocumented :fontset attribute for a face, I can get that face to use the CJK font in the fontset (recall that if I set the :font attribute with a fontset, the fontset is turned into an ASCII font). That comes with a catch: setting the :fontset attribute for the default face does not work. However, setting the frame parameter “font” to the fontset works. This “solution” cannot be described better than this image:



That said, if Handa-san reviews the change and thinks it's a good
idea, I will withdraw my objections.

That’ll be the best I can hope for it seems.

Yuan

reply via email to

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