Lets say you deal with Thai writing a lot but your default font doesn't support it, or you just really like the look of another font for Thai writing.

Have a look at script-representative-chars and list-charset-chars to see if what you're looking for is listed, then use that name. Alternatively, use describe-char on one of the characters in question and look at the charset or script entries.

(set-fontset-font t 'thai "Noto Sans Thai" )

This can result in enormous speed-ups as Emacs no longer has to run through hundreds of fonts looking for a compatible one.

If you need to set a fall-back font for Thai writing then you just do it the same as above.

(set-fontset-font t 'thai "Leelawadee UI" nil 'append)

The downside of this is that if you're using your configuration on machines that don't have these fonts then it won't even bother searching for a compatible font and will just give you a row of boxes. But don't worry, we can force Emacs to search by using font-spec .

(set-fontset-font t 'thai (font-spec :script 'thai) nil 'append)

You can put whatever you want in that call to font-spec and Emacs will search through the fonts to find something suitable. There's no reason why you couldn't use font-spec to set a specific font.

So our completed configuration for Thai writing now looks like this:

(set-fontset-font t 'thai "Noto Sans Thai" ) (set-fontset-font t 'thai "Leelawadee UI" nil 'append) (set-fontset-font t 'thai (font-spec :script 'thai) nil 'append)