GNU bug report logs -
#59347
29.0.50; `:family` face setting ignored
Previous Next
Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>
Date: Fri, 18 Nov 2022 04:58:01 UTC
Severity: normal
Found in version 29.0.50
Done: Gregory Heytings <gregory <at> heytings.org>
Bug is archived. No further changes may be made.
Full log
Message #317 received at 59347 <at> debbugs.gnu.org (full text, mbox):
>
> And also note that, should a user really want a specific ultra-bold font
> for a certain face, that is already possible with the existing
> infrastructure, by making that choice explicit, e.g. (set-face-attribute
> 'bold nil :font "Desired Font" :weight 'ultra-bold). And it is also
> possible, with the existing infrastructure, to list the available fonts
> with given attribute values, e.g. with (list-fonts (font-spec :weight
> 'ultra-bold)), and to select the best one in that list with an
> appropriate fourth argument to list-fonts.
>
FWIW, here is a macro to do that:
(defmacro set-mandatory-face-attribute (face frame &rest args)
"Set attributes of FACE on FRAME from ARGS.
This function behaves like `set-face-attribute', which see,
except that attributes must match exactly, and that all available
fonts are considered."
`(let ((spec (font-spec ,@args)))
(let ((candidates
(list-fonts
spec ,frame 1
(font-spec :width (face-attribute 'default :width)
:size (face-attribute 'default :height)
:weight (face-attribute 'default :weight)
:slant (face-attribute 'default :slant)))))
(if candidates
(set-face-attribute
,face ,frame
:font (format "%s" (font-get (car candidates) :family))
,@args)
(error "No available font for the specified attributes")))))
This bug report was last modified 2 years and 159 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.