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 13:51:23 -0700

> I asked why not use :family and :foundry in the face definition.  Did
> you try that?

:family, :foundry, :font, they all realize into _one_ font. My point is, to 
cover all characters might be displayed, the face needs _multiple_ fonts 
(therefore I need to use a fontset).

Suppose you know Chinese. You want serif CJK and Latin font for variable-pitch, 
and sans CJK and Latin font for default. 

|                | CJK              | Latin   |
| variable-pitch | Source Han Serif | Charter |
| default            | Source Han Sans  | SF Mono |

How do you make variable-pitch use Source Han Serif for CJK and Charter for 
Latin with :family or :foundry attribute? Unless I’m incredibly ignorant of 
something, you cannot. That’s why we have fontsets: it’s basically a mega font 
composed of multiple fonts that can use different fonts for different 
characters. Do we agree on that?

>>> 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.
> 
> And the description what happens with the code is for that second
> example, or is it for the first?  And the same question about your
> proposed fix -- which case does it fix?

The description of what happens with the code explains what happens with both 
:font and :fontset—both has problems.

Problem 1: The following doesn’t work as intended:

(set-face-attribute 'variable-pitch nil :font "fontset-serif”)

where “fontset-serif” contains two fonts: Charter for Latin and Source Han 
Serif for CJK. 

The current effect is, Latin characters in ‘variable-pitch works (displayed in 
Charter), CJK characters don’t (not displayed in Source Han Serif). With my 
fix, CJK characters work (displayed in Source Han Serif).

Problem 2: ‘default face cannot use fontset. Even if problem 1 is fixed, 
setting the fontset for the default face still doesn’t display CJK characters 
correctly. With the fix, setting a fontset for ‘default works as intended.

The problems are not limited to CJK characters, any other non-ASCII character 
that requires a font different from the Latin characters has the same problem.

My fix is based on the assumption that we want to use :font attribute for both 
font and fontsets, which is what the manual says, and is what Handa-san said 
what RMS wanted.

Yuan






reply via email to

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