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: Tue, 05 Oct 2021 19:12:14 +0300

> From: Yuan Fu <casouri@gmail.com>
> Date: Tue, 5 Oct 2021 08:36:26 -0700
> Cc: Eli Zaretskii <eliz@gnu.org>,
>  49797@debbugs.gnu.org
> 
> I finally got myself a Linux machine and am able to use gdb and poke around 
> in xfaces.c. I think the reason why setting custom fontset doesn’t work is at 
> here, in Finternal_set_lisp_face_attribute at xfaces.c:3425:
> 
>                 if (STRINGP (value))
>                   {
>                     Lisp_Object name = value;
>                     int fontset = fs_query_fontset (name, 0);
> 
>                     if (fontset >= 0)
>                       name = fontset_ascii (fontset);
>                     value = font_spec_from_name (name);
>                     if (!FONTP (value))
>                       signal_error ("Invalid font name", name);
>                   }
>                 else
>                   signal_error ("Invalid font or font-spec", value);
> 
> Basically, if I try to set a custom fontset to the :font attribute, Emacs 
> takes the ASCII font from my custom fontset, and set the :font attribute to 
> that ASCII font. Then if the face is the default face, in 
> set_font_frame_param, Emacs translates the font attribute to the frame’s 
> “font" parameter. Finally in gui_set_font, Emacs looks at the “font” frame 
> parameter and sets frame’s font.
> 
> If I try to set :fontset attribute for ‘default, 
> Finternal_set_lisp_face_attribute works just fine, setting the fontset 
> attribute in the face, but set_font_frame_param completely ignores the 
> fontset attribute, still setting the “font” frame parameter with the :font 
> attribute, and gui_set_font uses the “font” frame parameter . That’s why 
> setting :fontset takes no effect either.
> 
> For faces other than default, setting :fontset works fine, because 
> realize_gui_face handles :fontset attribute correctly. But it doesn’t handle 
> the case where the :font attribute contains a fontset. It works right now 
> because Finternal_set_lisp_face always converts the fontset passed to :font 
> attribute to an font (as described above).
> 
> Here is my attempt to fix it:

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.

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.

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?

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?

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.

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

Thanks.





reply via email to

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