I want to use SourceCodePro as my default font but it doesn't cover persian characters which are in the scope of for example #x0600 untill #x06FF.
I tried somthing like this
(set-fontset-font t
'ascii
"Source Code Pro-12")
(set-fontset-font t
(cons (decode-char 'ucs #x0600)
(decode-char 'ucs #x6FF))
"Roya-13")
but it didn't worked.
Also I tried to use fontset-standard and fontset-default like this
(set-face-font 'default "fontset-default")
(set-fontset-font "fontset-default"
'emacs (font-spec :name "Source Code Pro"))
(set-fontset-font "fontset-default"
'iso-8859-1 (font-spec :name "Source Code Pro"))
(set-face-attribute 'font-lock-comment-face nil
:family "Inconsolata" :height 140)
(set-fontset-font "fontset-default"
'(#x0600 . #x06FF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#x0750 . #x075F) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#x08A0 . #x08FF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#xFB50 . #xFDFF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#xFD70 . #xFEFF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
(set-fontset-font "fontset-default"
'(#x1EE00 . #x1EEFF) (font-spec :name "Roya:pixelsize=16:foundry=farsiweb:weight=normal:slant=normal:width=normal:scalable=true"))
this didn't work either.
Update: thanks to guidance from @legoscia using `after-make-frame-functions' makes it work for me
(defun zzgraph/fix-fontset (&optional frame)
(set-fontset-font "fontset-default" 'arabic "Roya"))
(add-hook 'after-make-frame-functions 'zzgraph/fix-fontset)
In Emacs 24, you don't need to set the frame's font to
"fontset-default". Just modifyingfontset-defaultwill be enough to alter the default fallback behaviour. In the snippet you posted, the font:nameproperty includes a lot of extra baggage that is not part of the name. Try eliminating this, and using just "Roya". If you have other fonts called "Roya" that are unsuitable, you might need to include more than just the font name to differentiate which font, but you should use separate properties to do this, not bundle them in as part of the:nameproperty.So in summary: