Use San Francisco Font for SF Symbols Everywhere in Emacs

Today I learned that you can tell Emacs to use fontsets (or just “fonts”) for specific character ranges. Thanks to Alan at for the explanation!

His example is this:

(set-fontset-font t '(?😊 . ?😎) "Segoe UI Emoji")

Now instead of Emoji, which work fine in Emacs for me out of the box, I want SF Symbols. Yes, again.

SF Symbols are in the Unicode private use area-b, at the very end of the Unicode table, U+100000..U+10FFFD.

I have no clue how to get the first and last of them; so I just map the whole private use area-b to the San Francisco font SF Pro Display, which shows SF Symbols just nicely.

To replace the Emoji characters from Alan’s example with these un-typable unicode characters, rely on their hex code range: insert-char accepts the hexadecimal codes directly even though the characters are not part of the preview. So use M-x insert-char 100000 and M-x insert-char 10FFFD.

The result (you can copy-paste, but won’t see the symbols here):

(set-fontset-font t '(?􀀀 . ?􏿽) "SF Pro Display")

And that’s it!

I can now revert the font overrides in my tab bar modifications.

And as a bonus, I now actually see the symbols in the Elisp code (which was previously not possible at all):

My tab bar numbers display SF Symbols now!

So wherever I paste a SF Symbol, I now see the symbol. Mode-line, tab-bar, code, text, it doesn’t matter.

Update 2023-01-08: Álvaro Ramírez uses a fallback font instead. So no need to specify the character range. This might suffice, too, if you don’t mind other glyphs being taken from the fallback font in case your main font misses some arcane special character. Check out Álvaro’s post for a GIF demo, too.

Receive new .