Is it possible to override glyphs at some range of code points, that the default-font already covers, with ones from a non-default font?

For instance, I'd like to use Arial only except for the uppercase letters, which I want to use Cooper Black for. How can I achieve this?

I know that I can override some rage of code points whose glyphs are missing in the default font, but I'm failing to do the same for the code points whose glyphs exist in the default font.

Here's what I tested.

(set-face-attribute 'default nil :family "Arial")
(let (
(my-upper-case-font "Cooper Black")
(font-sets '(
(lambda (font-set)

(set-fontset-font font-set '(#x00. #x17F) my-upper-case-font)
;I set the range wider for the sake of testing. 
;This doesn't work and when I inserted "t" after "font-set", 
;a message showed up saying "Wrong type argument: frame-live-p, "Cooper Black""

See this question I asked: Override the default font for emoji characters. The gist of it is that you have to set use-default-font-for-symbols to nil to make Emacs honor the fontsets. Then you can specify the fontsets themselves, which can be simply

(set-fontset-font t '(#x00. #x17F) my-upper-case-font)

See also the manual and "best practice" for configuring fonts in Emacs today - fontsets, the default face, and ... IDK, like, stabbing things, maybe? on Reddit (Eli Zaretskii, one of Emacs' maintainers, posted some tips there).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.