Created
August 20, 2022 10:35
-
-
Save lokedhs/afcd0054b94a8cc8c0c0f8dc1d8a63bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun compute-font-dpi () | |
(let* ((display (clim-clx:clx-port-display (clim:find-port))) | |
(db (xlib:root-resources (xlib:display-default-screen display))) | |
(res (xlib:get-resource db :|dpi| :|Dpi| '(:xft) '(:|Xft|))) | |
(default-sizes '(:normal 14 :tiny 8 :very-small 10 :small 12 :large 18 :very-large 20 :huge 24))) | |
(when res | |
(alexandria:when-let ((font-size (parse-integer res :junk-allowed t))) | |
(let* ((default-dpi 96) | |
(font-scale (/ font-size default-dpi))) | |
(setq climi::+font-sizes+ | |
(loop | |
for (type size) on default-sizes by #'cddr | |
append (list type (* size font-scale))))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment