emacs init: Set default font
This page shows you how to set font for emacs in init file.
Set Font to Init File, via Graphical User Interface Menu
Chose the menu:
- menu [Options ▸ Set Default Font…]
- menu [Options ▸ Save Options].
font setting is saved to the Emacs Init File in the custom-set-variables section. [see emacs init: M-x customize]
Set Font in Init File
put this in your Emacs Init File:
;; set overall font (set-frame-font (let ((fontlist (font-family-list))) (cond ((member "Cascadia Mono" fontlist) "Cascadia Mono") ((member "Consolas" fontlist) "Consolas") ((member "Menlo" fontlist) "Menlo") ((member "DejaVu Sans Mono" fontlist) "DejaVu Sans Mono") (t nil))) t t)
List available fonts
(print (font-family-list))
[see Evaluate Emacs Lisp Code]
Check if a font exist
;; returns true if Symbola exists (member "Symbola" (font-family-list))