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

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

bug#59347: 29.0.50; `:family` face setting ignored


From: Eli Zaretskii
Subject: bug#59347: 29.0.50; `:family` face setting ignored
Date: Mon, 12 Dec 2022 19:10:56 +0200

> Date: Mon, 12 Dec 2022 16:12:22 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: luangruo@yahoo.com, monnier@iro.umontreal.ca, 59347@debbugs.gnu.org
> 
> Yes.  The gist of the original docstring, which was correct (and I think 
> understandable even by non-experts), is this:
> 
> "When the font chosen for the default face has a weight, slant or width 
> that is not supported by other available fonts on the system, such as 
> 'medium', Emacs may select suboptimal fonts for other faces."

This was important when the default value was hard to understand.  It
is less important when the default value is easily understood and
interpreted.  I will add something along these lines when I will
change the default to t, because then the effect will again be less
clear.

> As I explained, the root of this bug is an undesirable interaction with 
> the weight/slant/widht (and possibly other attributes, time will tell us) 
> of the _default_ face, when they are set to unusual/less common values, 
> with the fonts that are selected for _other faces_ in which these 
> attributes are _unspecified_.

That is the case that was in your mind, but that is not the only case
where realize_gui_face is called.  It is also called when faces are
merged (which happens a lot in Emacs), and in a few other cases.  In
those cases I think the situation is less black-and-white, since each
attribute can come from a different face, or be inherited.

> That is a very specific corner case, and the current variable name and 
> docstring does not reflect this (namely, that it's a very specific corner 
> case, in a very specific area of code).  The current docstring means 
> something completely different.  Saying for example that "face attributes 
> will be treated as "soft" constraints when looking for suitable fonts: if 
> an exact match is not possible, a font can be selected that is a close, 
> but not an exact, match" means that when an attribute is _specified_ Emacs 
> will treat that attribute value in a lax manner, which is already (and has 
> always been) the case, and when the purpose of that variable is to affect 
> font selection for faces whose attributes are _unspecified_.

When you say that it "is already (and has always been) the case",
AFAIU you are talking about the lower-level code, not about the level
on which this new variable makes a difference.  On this level, the
match is required to be exact, and clearing some attributes allows it
to be "lax".  Otherwise, why did we make this change, if the
constraints were already not "hard"?

> This was also important:
> 
> "There is no reason to change that value except for debugging purposes."

I will add something like that.

> > Anyway, here's my proposal:
> >
> > . we change the default value of the variable to be t, and document that 
> > this stands for (:weight :width :slant)
> >
> > . we change the code to reset only those 3 attributes when the value is 
> > t, and to reset nothing when the value is nil
> >
> > . the (slower) code which loops over the list will only run if the value 
> > of the variable is neither nil nor t
> >
> > . we avoid resetting the :extra attribute on Haiku
> >
> 
> As long as we don't traverse a Lisp list each time a face is realized in 
> the default case, I'm fine with this.

OK, thanks.

> I think Stefan's proposal (write an Elisp-level interface) is
> slightly better, though, because if we find out in Emacs 30 or 31
> that some other attribute must also be unset, the meaning of 't'
> would have to change.

I wouldn't invest more energy in this at this point, since we don't
yet know whether it is needed and how badly.  Our hope, after all, is
that no one will ever need to change the default value of this
variable.  From that perspective, inventing fancy functions to make it
easier to customize a bitmap is overkill.





reply via email to

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