Paste number 59061: Resolution-based font selection

Paste number 59061: Resolution-based font selection
Pasted by: z0d
When:1 year, 2 months ago
Share:Tweet this! | http://paste.lisp.org/+19KL
Channel:None
Paste contents:
Raw Source | XML | Display As
(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))

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.