From d5ed7d10f3a097c4f85342ed5d234104ac495d87 Mon Sep 17 00:00:00 2001 From: Daniel Weschke Date: Mon, 7 Jul 2025 15:03:09 +0200 Subject: [PATCH] fix font fallback --- settings/org-settings.el | 97 +++++++++++++++++++++++++------------- settings/theme-settings.el | 8 +++- 2 files changed, 71 insertions(+), 34 deletions(-) diff --git a/settings/org-settings.el b/settings/org-settings.el index ab0408fa..c493d433 100644 --- a/settings/org-settings.el +++ b/settings/org-settings.el @@ -508,35 +508,56 @@ Suggest the URL title as a description for resource." ;; (?I . "Important"))) ;; 🅰 🅱 🅲 🅳 (setq org-fancy-priorities-list - ;; ,(nerd-icons-mdicon "nf-md-alpha_a_box_outline") - ;; ,(nerd-icons-mdicon "nf-md-alpha_b_box_outline") - `((?A . ,#("󰯫" 0 1 (face (:family "Symbols Nerd Font Mono" :height 1.0) - font-lock-face (:family "Symbols Nerd Font Mono" :height 1.0) - display (raise 0.10) rear-nonsticky t))) - (?B . ,#("󰯮" 0 1 (face (:family "Symbols Nerd Font Mono" :height 1.0) - font-lock-face (:family "Symbols Nerd Font Mono" :height 1.0) - display (raise 0.10) rear-nonsticky t))) - (?C . ,#("󰯱" 0 1 (face (:family "Symbols Nerd Font Mono" :height 1.0) - font-lock-face (:family "Symbols Nerd Font Mono" :height 1.0) - display (raise 0.10) rear-nonsticky t))) - (?D . ,#("󰯴" 0 1 (face (:family "Symbols Nerd Font Mono" :height 1.0) - font-lock-face (:family "Symbols Nerd Font Mono" :height 1.0) - display (raise 0.10) rear-nonsticky t))))) + (cond + ;; ,(nerd-icons-mdicon "nf-md-alpha_a_box_outline") + ;; ,(nerd-icons-mdicon "nf-md-alpha_b_box_outline") + ;; ,(nerd-icons-mdicon "nf-md-alpha_c_box_outline") + ;; ,(nerd-icons-mdicon "nf-md-alpha_d_box_outline") + ((find-font (font-spec :family "Symbols Nerd Font Mono")) + `((?A . ,#("󰯫" 0 1 (face (:family "Symbols Nerd Font Mono" :height 1.0) + font-lock-face (:family "Symbols Nerd Font Mono" :height 1.0) + display (raise 0.10) rear-nonsticky t))) + (?B . ,#("󰯮" 0 1 (face (:family "Symbols Nerd Font Mono" :height 1.0) + font-lock-face (:family "Symbols Nerd Font Mono" :height 1.0) + display (raise 0.10) rear-nonsticky t))) + (?C . ,#("󰯱" 0 1 (face (:family "Symbols Nerd Font Mono" :height 1.0) + font-lock-face (:family "Symbols Nerd Font Mono" :height 1.0) + display (raise 0.10) rear-nonsticky t))) + (?D . ,#("󰯴" 0 1 (face (:family "Symbols Nerd Font Mono" :height 1.0) + font-lock-face (:family "Symbols Nerd Font Mono" :height 1.0) + display (raise 0.10) rear-nonsticky t))))) + (t '("🅰" "🅱" "🅲" "🅳")) )) ;; IndianRed1 DeepSkyBlue1 (setq org-priority-faces - `((?A :foreground "#df5f5f" - :height ,(- (face-attribute 'default :height) -5)) - (?B :foreground "DarkOrange1" - :height ,(- (face-attribute 'default :height) -5)) - (?C :foreground "yellow1" - :height ,(- (face-attribute 'default :height) -5)) - (?D :foreground "green1" - :height ,(- (face-attribute 'default :height) -5)) - (?1 :foreground "#df5f5f" :weight 'bold) - (?2 :foreground "DarkOrange1") - (?3 :foreground "yellow1") - (?4 :foreground "green1") - (?I :foreground "#df5f5f" :weight 'bold)))) + (cond + ((find-font (font-spec :family "Symbols Nerd Font Mono")) + `((?A :foreground "#df5f5f" + :height ,(- (face-attribute 'default :height) -5)) + (?B :foreground "DarkOrange1" + :height ,(- (face-attribute 'default :height) -5)) + (?C :foreground "yellow1" + :height ,(- (face-attribute 'default :height) -5)) + (?D :foreground "green1" + :height ,(- (face-attribute 'default :height) -5)) + (?1 :foreground "#df5f5f" :weight 'bold) + (?2 :foreground "DarkOrange1") + (?3 :foreground "yellow1") + (?4 :foreground "green1") + (?I :foreground "#df5f5f" :weight 'bold))) + (t + `((?A :foreground "#df5f5f" + :height ,(- (face-attribute 'default :height) 10)) + (?B :foreground "DarkOrange1" + :height ,(- (face-attribute 'default :height) 10)) + (?C :foreground "yellow1" + :height ,(- (face-attribute 'default :height) 10)) + (?D :foreground "green1" + :height ,(- (face-attribute 'default :height) 10)) + (?1 :foreground "#df5f5f" :weight 'bold) + (?2 :foreground "DarkOrange1") + (?3 :foreground "yellow1") + (?4 :foreground "green1") + (?I :foreground "#df5f5f" :weight 'bold))) )) (use-package org-fragtog :hook (org-mode . org-fragtog-mode)) @@ -637,7 +658,12 @@ Suggest the URL title as a description for resource." (setq org-superstar-leading-bullet " ·") ;; " ․" " ·" " ⚫" or to hide: ?\s (without quotation marks) (setq org-superstar-remove-leading-stars nil) ;; to remove the indentation, needs org-superstar-leading-bullet set to ?\s (setq org-superstar-headline-bullets-list - '(?󰓎 ?󰓒 ?󰫢 ?󰫣 ?󰫤 ?󰫥)) ;; '(?󰄯 ?󰄰 ?󰻂 ?󰻃 ?󰓏 ?󰦤 ? ?󰺕) + ;; ◆◇▲△▴▵★☆✦✧✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋ + (cond + ((find-font (font-spec :family "Symbols Nerd Font Mono")) + '(?󰓎 ?󰓒 ?󰫢 ?󰫣 ?󰫤 ?󰫥)) ;; '(?󰄯 ?󰄰 ?󰻂 ?󰻃 ?󰓏 ?󰦤 ? ?󰺕) + (t + '(?★ ?☆ ?✦ ?✧ ?▴ ?▵)) )) ;; '(?◉ ?○ ?✸ ?✿) 󰄯 󰄰 󰘻 󰘼 󰺕 󰬸 󰚕 󰻂 󰻃    󰓏 󰦤    󰐗 󰐙 ;; 󰓎 󰓒 󰫢 󰫣 󰫤 󰫥 ;; (setq org-superstar-leading-bullet ?\s) @@ -654,10 +680,17 @@ Suggest the URL title as a description for resource." (?- . ?–))) (setq org-superstar-special-todo-items t) ;; using symbols defined in org-superstar-todo-bullet-alist (setq org-superstar-todo-bullet-alist ;; ☐ ☑ ☒ - '(("TODO" ?󰀼 ?☐) ;;              󰀼 󱝋 󱝍 󱝏 - ("WAIT" . ?󱝏) - ("DONE" . ?󱝍) - ("CANC" . ?󱝋))) + (cond + ((find-font (font-spec :family "Symbols Nerd Font Mono")) + '(("TODO" ?󰀼 ?☐) ;;              󰀼 󱝋 󱝍 󱝏 + ("WAIT" . ?󱝏) + ("DONE" . ?󱝍) + ("CANC" . ?󱝋))) + (t + '(("TODO" . ?☐) ;;              󰀼 󱝋 󱝍 󱝏 + ("WAIT" . ?◷) + ("DONE" . ?☑) + ("CANC" . ?☒))) )) (set-face-attribute 'org-superstar-leading nil :foreground "#42444a")) ;; "#42444a" diff --git a/settings/theme-settings.el b/settings/theme-settings.el index 6e8c5d65..302bcb4a 100644 --- a/settings/theme-settings.el +++ b/settings/theme-settings.el @@ -51,9 +51,13 @@ ;; ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█ ;; see M-x describe-char -(set-face-font 'default (font-spec :family "FiraCode Nerd Font" :size 13)) +(cond + ((find-font (font-spec :family "FiraCode Nerd Font")) + (set-face-font 'default (font-spec :family "FiraCode Nerd Font" :size 13))) + ((find-font (font-spec :family "DejaVu Sans Mono")) + (set-frame-font (font-spec :family "DejaVu Sans Mono" :size 15))) ) -;; (set-fontset-font FONTSET CHARACTERS FONT-SPEC &optional FRAME ADD) +;; (Set-fontset-font FONTSET CHARACTERS FONT-SPEC &optional FRAME ADD) ;; CHARACTERS see `script-representative-chars' and ;; ‘list-character-sets’ and ‘list-charset-chars’ for the list of ;; character sets and their characters.