Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Code to set emacs font to best font, and workaround some fallback bug by forcing it to certain codeblocks
;; default
(progn
(setq melissa/font-default "Iosevka Term SS05 Medium")
(set-face-attribute 'default nil :font melissa/font-default :height 140 :slant 'normal)
;; (setq melissa/font-default "Victor Mono SemiBold")
;; (set-face-attribute 'default nil :font melissa/font-default :height 140 :slant 'italic)
;; (setq melissa/font-default "Iosevka Term SS05 Semibold")
;; (set-face-attribute 'default nil :font melissa/font-default :height 140 :slant 'normal)
(setq melissa/font-ja "Noto Sans Mono CJK JP")
(set-face-attribute 'variable-pitch nil :font "Iosevka Etoile" :height 140 :slant 'normal)
(set-fontset-font t nil melissa/font-ja) ; nil prepend?
(set-fontset-font t 'han melissa/font-ja)
(set-fontset-font t 'japanese-jisx0213.2004-1 melissa/font-ja)
(set-fontset-font t 'phonetic melissa/font-default)
;; forcing IPA misc & other blocks without scripts
;;
;; IPA Extensions: U+0250–02AF ɔɮʥ
;; Spacing Modifier Letters: U+02B0–02FF ʱ ˥ ˳
;; Phonetic Extensions: U+1D00–1D7F ᴥᴔᵺ
;; Phonetic Extensions Supplement: U+1D80–1DBF ᶕ ᶘ ᶽ
;; Modifier Tone Letters: U+A700–A71F ꜒ ꜓ a꜒꜓
;; Superscripts and Subscripts: U+2070–209F ⁽ ⁿ ⁾
;;
;; Geometric shapes U+25A0..U+25FF often gets from CJVK font ◌▻◎●
;;
(setq forceblocks '(
(#x0250 . #x02af)
(#x02b0 . #x02ff)
(#x1d00 . #x1d7f)
(#xa700 . #xa71f)
(#x2070 . #x209f)
(#x25a0 . #x25ff)
))
(dolist (pair forceblocks)
(set-fontset-font t pair melissa/font-default))
;; (add-hook 'markdown-mode-hook (lambda () (variable-pitch-mode t))
;; forcing over fallbacks
(set-fontset-font t 'greek melissa/font-default)
(set-fontset-font t 'cyrillic melissa/font-default)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment