; Improve docs of relaxing face-font attribute match (bug#59347)

* src/xfaces.c (realize_gui_face): Fix typo and coding style.
(syms_of_xfaces) <face-font-lax-matched-attributes>: A better name.
This commit is contained in:
Eli Zaretskii 2022-12-11 11:49:29 +02:00
parent f221105723
commit 2024ade271

View file

@ -6021,9 +6021,7 @@ static void
font_unset_attribute (Lisp_Object font_object, enum font_property_index index,
Lisp_Object symbol)
{
Lisp_Object tail;
tail = Vfont_fallback_ignored_attributes;
Lisp_Object tail = Vface_font_lax_matched_attributes;
FOR_EACH_TAIL_SAFE (tail)
{
@ -6046,7 +6044,7 @@ realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]
#ifdef HAVE_WINDOW_SYSTEM
struct face *default_face;
struct frame *f;
Lisp_Object stipple, underline, overline, strike_through, box, spec;
Lisp_Object stipple, underline, overline, strike_through, box;
eassert (FRAME_WINDOW_P (cache->f));
@ -6089,7 +6087,7 @@ realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]
}
if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX]))
{
spec = copy_font_spec (attrs[LFACE_FONT_INDEX]);
Lisp_Object spec = copy_font_spec (attrs[LFACE_FONT_INDEX]);
/* Unset several values in SPEC, usually the width, slant,
and weight. The best possible values for these
@ -6102,7 +6100,7 @@ realize_gui_face (struct face_cache *cache, Lisp_Object attrs[LFACE_VECTOR_SIZE]
fonts that are exact matches for these weight, slant and
width attributes, which leads to suboptimal or wrong font
choices. (bug#5934) */
font_unset_attribute (spec, FONT_WEIGHT_INDEX, QCwidth);
font_unset_attribute (spec, FONT_WEIGHT_INDEX, QCweight);
font_unset_attribute (spec, FONT_SLANT_INDEX, QCslant);
font_unset_attribute (spec, FONT_WIDTH_INDEX, QCwidth);
/* Also allow unsetting other attributes for debugging
@ -7406,22 +7404,24 @@ Lisp programs that change the value of this variable should also
clear the face cache, see `clear-face-cache'. */);
face_near_same_color_threshold = 30000;
DEFVAR_LISP ("font-fallback-ignored-attributes",
Vfont_fallback_ignored_attributes,
doc: /* A list of face attributes to ignore.
DEFVAR_LISP ("face-font-lax-matched-attributes",
Vface_font_lax_matched_attributes,
doc: /* Font-related face attributes to match in lax manner when realizing faces.
List of font-related face attributes to ignore when realizing a face.
This is a list of symbols representing face attributes that will be
ignored by Emacs when realizing a face, and an exact match couldn't be
found for its preferred font. For example:
The value should be a list of face attribute symbols; see
`set-face-attribute' for the full list of attributes. The
corresponding 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. For
example, looking for a semi-bold font might select a bold or a medium
font if no semi-bold font matching other attributes is found. Emacs
still tries to find a font that is the closest possible match; in
particular, if a font is available that matches the face attributes
exactly, it will be selected.
(:weight :slant :width)
tells Emacs to ignore the `:weight', `:slant' and `:width' face
attributes when searching for a font and an exact match could not be
found for the font attributes specified in the face being realized. */);
Vfont_fallback_ignored_attributes
= list3 (QCwidth, QCslant, QCwidth);
Note that if the `:extra' attribute is present in the value, it
will be ignored. */);
Vface_font_lax_matched_attributes = list3 (QCweight, QCslant, QCwidth);
#ifdef HAVE_WINDOW_SYSTEM
defsubr (&Sbitmap_spec_p);