about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2020-12-21 22:51:43 -0600
committerCase Duckworth2020-12-21 22:51:43 -0600
commit4936d3a8afd2e9fca9be03025e782383e2a90150 (patch)
tree2bce78689cf111567660999435336fefce23b0a9
parentAdd async (diff)
downloademacs-4936d3a8afd2e9fca9be03025e782383e2a90150.tar.gz
emacs-4936d3a8afd2e9fca9be03025e782383e2a90150.zip
Betterize font setting
-rw-r--r--config.org56
1 files changed, 34 insertions, 22 deletions
diff --git a/config.org b/config.org index 0bfded6..9b45e36 100644 --- a/config.org +++ b/config.org
@@ -437,34 +437,46 @@ from [[https://github.com/link0ff/emacs-init][link0ff]].
437 (if (find-font (font-spec :name font)) 437 (if (find-font (font-spec :name font))
438 (throw :font font))))) 438 (throw :font font)))))
439 439
440 (defun set-face-from-alternatives (face fonts)
441 (dolist (font fonts)
442 (if (find-font (font-spec :family (car font)))
443 (apply #'set-face-attribute `(,face nil
444 :family ,(car font)
445 ,@(cdr font))))))
446
440 (defun acdw/setup-fonts () 447 (defun acdw/setup-fonts ()
441 "Setup fonts. This has to happen after the frame is setup for 448 "Setup fonts. This has to happen after the frame is setup for
442 the first time, so it should be added to `window-setup-hook'. It 449 the first time, so it should be added to `window-setup-hook'. It
443 removes itself from that hook." 450 removes itself from that hook."
444 (interactive) 451 (interactive)
445 (when (display-graphic-p) 452 (when (display-graphic-p)
446 (set-face-attribute 'default nil 453 (set-face-from-alternatives 'default
447 :font 454 '(("Libertinus Mono"
448 (font-candidate 455 :height 110)
449 "Libertinus Mono-11" 456 ("Linux Libertine Mono O"
450 "Linux Libertine Mono O-11" 457 :height 110)
451 "Go Mono-10" 458 ("Go Mono"
452 "Consolas-10")) 459 :height 100)
453 460 ("Consolas"
454 (set-face-attribute 'fixed-pitch nil 461 :height 100)))
455 :font 462
456 (font-candidate 463 (set-face-from-alternatives 'fixed-pitch
457 "Libertinus Mono-11" 464 '(("Libertinus Mono"
458 "Linux Libertine Mono O-11" 465 :height 1.0)
459 "Go Mono-10" 466 ("Linux Libertine Mono O"
460 "Consolas-10")) 467 :height 1.0)
461 468 ("Go Mono"
462 (set-face-attribute 'variable-pitch nil 469 :height 1.0)
463 :font 470 ("Consolas"
464 (font-candidate 471 :height 1.0)))
465 "Libertinus Serif-13" 472
466 "Linux Libertine O-12" 473 (set-face-from-alternatives 'variable-pitch
467 "Georgia-11")) 474 '(("Libertinus Serif"
475 :height 1.0)
476 ("Linux Libertine O"
477 :height 1.0)
478 ("Georgia"
479 :height 1.0)))
468 480
469 (remove-function after-focus-change-function #'acdw/setup-fonts))) 481 (remove-function after-focus-change-function #'acdw/setup-fonts)))
470 482