1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- (require 'cl-lib)
- (defvar al/font-candidates
- '("Liberation Mono-12" "DejaVu Sans Mono-11" "Terminus-12")
- "List of font names used by `al/first-existing-font'.")
- (defun al/first-existing-font (&rest font-names)
- "Return the first existing font from FONT-NAMES.
- If FONT-NAMES is nil, use `al/font-candidates'."
- (cl-find-if (lambda (name)
- (find-font (font-spec :name name)))
- (or font-names al/font-candidates)))
- (defun al/set-fontset (&optional name frame add specs)
- "Modify fontset NAME.
- Each specification from SPECS list has the following form:
- (FONT . TARGETS)
- TARGETS is a list of characters TARGET. See `set-fontset-font'
- for details."
- (dolist (spec specs)
- (pcase spec
- (`(,font . ,targets)
- (dolist (target targets)
- (set-fontset-font name target font frame add))))))
- (provide 'al-font)
|