; 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, font_unset_attribute (Lisp_Object font_object, enum font_property_index index,
Lisp_Object symbol) Lisp_Object symbol)
{ {
Lisp_Object tail; Lisp_Object tail = Vface_font_lax_matched_attributes;
tail = Vfont_fallback_ignored_attributes;
FOR_EACH_TAIL_SAFE (tail) 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 #ifdef HAVE_WINDOW_SYSTEM
struct face *default_face; struct face *default_face;
struct frame *f; 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)); 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])) 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, /* Unset several values in SPEC, usually the width, slant,
and weight. The best possible values for these 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 fonts that are exact matches for these weight, slant and
width attributes, which leads to suboptimal or wrong font width attributes, which leads to suboptimal or wrong font
choices. (bug#5934) */ 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_SLANT_INDEX, QCslant);
font_unset_attribute (spec, FONT_WIDTH_INDEX, QCwidth); font_unset_attribute (spec, FONT_WIDTH_INDEX, QCwidth);
/* Also allow unsetting other attributes for debugging /* 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'. */); clear the face cache, see `clear-face-cache'. */);
face_near_same_color_threshold = 30000; face_near_same_color_threshold = 30000;
DEFVAR_LISP ("font-fallback-ignored-attributes", DEFVAR_LISP ("face-font-lax-matched-attributes",
Vfont_fallback_ignored_attributes, Vface_font_lax_matched_attributes,
doc: /* A list of face attributes to ignore. 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. The value should be a list of face attribute symbols; see
This is a list of symbols representing face attributes that will be `set-face-attribute' for the full list of attributes. The
ignored by Emacs when realizing a face, and an exact match couldn't be corresponding face attributes will be treated as "soft" constraints
found for its preferred font. For example: 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) Note that if the `:extra' attribute is present in the value, it
will be ignored. */);
tells Emacs to ignore the `:weight', `:slant' and `:width' face Vface_font_lax_matched_attributes = list3 (QCweight, QCslant, QCwidth);
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);
#ifdef HAVE_WINDOW_SYSTEM #ifdef HAVE_WINDOW_SYSTEM
defsubr (&Sbitmap_spec_p); defsubr (&Sbitmap_spec_p);