Function: x-resolve-font-name
x-resolve-font-name is a byte-compiled function defined in
faces.el.gz.
Signature
(x-resolve-font-name PATTERN &optional FACE FRAME)
Documentation
Return a font name matching PATTERN.
All wildcards in PATTERN are instantiated. If PATTERN is nil, return the name of the frame's base font, which never contains wildcards. Given optional arguments FACE and FRAME, return a font which is also the same size as FACE on FRAME, or fail.
Source Code
;; Defined in /usr/src/emacs/lisp/faces.el.gz
(defun x-resolve-font-name (pattern &optional face frame)
"Return a font name matching PATTERN.
All wildcards in PATTERN are instantiated.
If PATTERN is nil, return the name of the frame's base font, which never
contains wildcards.
Given optional arguments FACE and FRAME, return a font which is
also the same size as FACE on FRAME, or fail."
(and (eq frame t)
(setq frame nil))
(if pattern
;; Note that x-list-fonts has code to handle a face with nil as its font.
(let ((fonts (x-list-fonts pattern face frame 1)))
(or fonts
(if face
(if (string-search "*" pattern)
(if (null (face-font face))
(error "No matching fonts are the same height as the frame default font")
(error "No matching fonts are the same height as face `%s'" face))
(if (null (face-font face))
(error "Height of font `%s' doesn't match the frame default font"
pattern)
(error "Height of font `%s' doesn't match face `%s'"
pattern face)))
(error "No fonts match `%s'" pattern)))
(car fonts))
(frame-parameter nil 'font)))