[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: |
Wed, 6 Oct 2021 11:56:18 -0700 |
> On Oct 6, 2021, at 11:33 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> 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.
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,
rfont_def = fontset_font (fontset, c, face, id);
finds a font in the fontset that can display character c. That’s hard to ignore.
>
>> 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.
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’t set :fontset
by itself, what’s the point for this attribute, then, if Emacs doesn’t set it
itself and don’t want the user to set it?
>
>>> 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.
I don’t think so. Anyway, you don’t seem convinced albeit clear evidences in my
eye. Let’s wait for Handa-san to enlighten us.
Yuan
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, (continued)
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Eli Zaretskii, 2021/10/05
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Eli Zaretskii, 2021/10/05
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Yuan Fu, 2021/10/05
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Eli Zaretskii, 2021/10/06
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Yuan Fu, 2021/10/06
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Eli Zaretskii, 2021/10/06
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work,
Yuan Fu <=
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Eli Zaretskii, 2021/10/06
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Yuan Fu, 2021/10/07
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Eli Zaretskii, 2021/10/08
- bug#49797: 28.0.50; Setting face to custom fontset doesn't work, Yuan Fu, 2021/10/08