| Paste number 59060: | Resolution-based font selection |
| Pasted by: | z0d |
| When: | 1 year, 2 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+19KK |
| Channel: | None |
| Paste contents: |
(defvar z0d:font-table
'(((1280 . 800) "DejaVu Sans Mono-10")
((1280 . 1024) "DejaVu Sans Mono-11")
((1680 . 1050) "DejaVu Sans Mono-12")
(t "DejaVu Sans Mono-10")))
(defvar z0d:frame-alist
'((cursor-color . "Gray40")
(tool-bar-lines . nil)))
(defun z0d:choose-font ()
"Return a font from z0d:font-table or return nil."
(let ((font (assoc (cons (x-display-pixel-width)
(x-display-pixel-height))
z0d:font-table)))
(or (cadr font)
(cadr (assoc t z0d:font-table))
nil)))
(defvar z0d:default-frame-alist
(let ((font (z0d:choose-font)))
(if font
(cons `(font . ,font)
z0d:frame-alist)
z0d:frame-alist)))
(when window-system
(setq default-frame-alist z0d:default-frame-alist))
Annotations for this paste:
| Annotation number 1: | Final version |
| Pasted by: | z0d |
| When: | 1 year, 2 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+19KK#1 |
| Paste contents: |
(defvar z0d:font-table
'(((1280 . 800) "DejaVu Sans Mono-10")
((1280 . 1024) "DejaVu Sans Mono-11")
((1680 . 1050) "DejaVu Sans Mono-12")
(t "DejaVu Sans Mono-10")))
(defvar z0d:frame-alist
'((cursor-color . "Gray40")
(tool-bar-lines . nil)))
(defun z0d:choose-font ()
"Return a font from z0d:font-table or return nil."
(when window-system
(let ((font (assoc (cons (x-display-pixel-width)
(x-display-pixel-height))
z0d:font-table)))
(or (cadr font)
(cadr (assoc t z0d:font-table))
nil))))
(defvar z0d:default-frame-alist
(let ((font (z0d:choose-font)))
(if font
(cons `(font . ,font)
z0d:frame-alist)
z0d:frame-alist)))
(when window-system
(setq default-frame-alist z0d:default-frame-alist))