From 7e8fb5cebd4031d947940ae8eeef0a2b72fb4cba Mon Sep 17 00:00:00 2001 From: Gregory Heytings Date: Mon, 21 Nov 2022 23:26:07 +0000 Subject: [PATCH] Unset the weight in font specs when searching for a font. Between commits bf0d3f76dc (2014) and 6b1ed2f2c9 (2022), realize_gui_face called font_load_for_lface with an empty or partly emptied font spec, i.e. it ignored a part of its attrs argument. The rationale given in bug#17973, which led to bf0d3f76dc, is not clear. However, 6b1ed2f2c9 leads to suboptimal font choices when the font chosen for the default face has a weight that is not supported by other available fonts on the system, such as 'medium' or 'heavy'. Therefore, the weight in the spec argument to font_find_for_lface must be unset. * src/font.c (font_find_for_lface): Unset the weight of the font spec. Fixes bug#57555 and bug#59347. --- src/font.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/font.c b/src/font.c index 6e720bc285..fc8019fe13 100644 --- a/src/font.c +++ b/src/font.c @@ -3003,6 +3003,10 @@ font_find_for_lface (struct frame *f, Lisp_Object *attrs, Lisp_Object spec, int } ASET (work, FONT_SIZE_INDEX, Qnil); + /* Also ignore the font weight, which when set leads to suboptimal + font choices. See bug#59347. */ + ASET (work, FONT_WEIGHT_INDEX, Qnil); + /* Foundry specification alternatives: from the most specific to the least specific and finally an unspecified one. */ foundry[0] = AREF (work, FONT_FOUNDRY_INDEX); -- 2.35.1