diff options
Diffstat (limited to 'lisp/play')
-rw-r--r-- | lisp/play/gamegrid.el | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el index 7a850b07ee4..3ad42114d01 100644 --- a/lisp/play/gamegrid.el +++ b/lisp/play/gamegrid.el @@ -72,7 +72,7 @@ directory will be used.") (defvar gamegrid-mono-x-face nil) (defvar gamegrid-mono-tty-face nil) -(defvar gamegrid-glyph-height-mm 7.0 +(defvar gamegrid-glyph-height-mm 5.0 "Desired glyph height in mm.") ;; ;;;;;;;;;;;;; glyph generation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -80,12 +80,20 @@ directory will be used.") (defun gamegrid-calculate-glyph-size () "Calculate appropriate glyph size in pixels based on display resolution. Return a multiple of 8 no less than 16." - (if (and (display-pixel-height) (display-mm-height)) - (let* ((y-pitch (/ (display-pixel-height) (float (display-mm-height)))) - (pixels (* y-pitch gamegrid-glyph-height-mm)) - (rounded (* (floor (/ (+ pixels 4) 8)) 8))) - (max 16 rounded)) - 16)) + (let ((atts (car (display-monitor-attributes-list))) + y-pitch) + (setq y-pitch (cond + (atts + (/ (nth 4 (assq 'geometry atts)) + (nth 2 (assq 'mm-size atts)) + (or (cdr (assq 'scale-factor atts)) 1.0))) + ((and (display-pixel-height) (display-mm-height)) + (/ (display-pixel-height) (float (display-mm-height)))))) + (if y-pitch + (let* ((pixels (* y-pitch gamegrid-glyph-height-mm)) + (rounded (* (floor (/ (+ pixels 4) 8)) 8))) + (max 16 rounded)) + 16))) ;; Example of glyph in XPM format: ;; @@ -336,7 +344,8 @@ format." (defun gamegrid-make-glyph (data-spec-list color-spec-list) (let ((data (gamegrid-match-spec-list data-spec-list)) - (color (gamegrid-match-spec-list color-spec-list))) + (color (gamegrid-match-spec-list color-spec-list)) + (image-scaling-factor 1.0)) (cond ((characterp data) (vector data)) ((eq data 'colorize) |