I'm trying to set a fallback font for variable-pitch
face.
More specifically, my current setup is:
- Default font set to JuliaMono with size 15 via
(set-frame-font "JuliaMono 15" nil t)
. - Fallback font for hangul (Korean) via
(set-fontset-font t 'hangul (font-spec :name "D2Coding"))
. - Variable pitch face set to EB Garamond with size 19 via
(set-face-attribute 'variable-pitch nil :font "EB Garamond" :height 190)
.
Is there a way to specifically add a new font used for Korean for variable pitch face (I'm trying to use Noto Serif CJK KR)? https://idiocy.org/emacs-fonts-and-fontsets.html only points to setting fallback fonts for different languages, and not face-specific.
Edit I spent the whole afternoon trying this--it is driving me mad!
I'm setting the default fonts following this and this:
(add-to-list 'after-make-frame-functions #'set-default-fonts)
(defun set-default-fonts (_)
(set-face-attribute 'default nil :font "JuliaMono 15")
(set-fontset-font "fontset-default" 'hangul (font-spec :family "D2Coding"))
(setq face-font-rescale-alist '(("D2Coding" . 1.2))))
Rescaling "D2Coding" is to make a single monospaced Korean letter correspond to two monospaced alphabets.
The (add-to-list ...)
part is to make it work with emacs --daemon
.
I'm trying to use mixed-pitch package to achieve variable pitch mode default in Org mode, so:
(use-package mixed-pitch
:ensure t
:hook
(org-mode . mixed-pitch-mode)
:config
(setq mixed-pitch-set-height t)
(set-face-attribute
'variable-pitch nil :font "fontset-myvariable"))
where the custom fontset "fontset-myvariable"
is set via:
(create-fontset-from-fontset-spec
(font-xlfd-name
(font-spec :family "EB Garamond"
:size 19
:registry "fontset-myvariable")))
(set-fontset-font
"fontset-myvariable"
'hangul (font-spec :family "Noto Serif CJK KR" :size 19))
With this, (EB Garamond in variable pitch face + English) & (D2Coding in fixed with + Korean) works great, but (variable pitch face + Korean) is in D2Coding not Noto Serif CJK KR.