Oerm · 2022-04-20 15:40
EDIT: Problem has been fixed, see update below.
I seem to have a problem that many others have faced before me. Unfortunately, none of the proposed solutions seem to work for me. I have the following font settings in my Emacs config:
```lisp
(set-face-attribute 'default nil
:font "FiraCode Nerd Font"
:height 140
:weight 'normal
:width 'normal)
(set-face-attribute 'fixed-pitch nil
:font "FiraCode Nerd Font"
:height 140
:weight 'light)
(set-face-attribute 'variable-pitch nil
:font "IBM Plex Sans"
:height 150
:weight 'regular)
(set-fontset-font t 'unicode "Noto Color Emoji" nil 'prepend)
```
On Linux, this has worked just fine but on macOS 12.3.1 some special characters are not displayed properly (e.g. `#x2b57` (HEAVY CIRCLE WITH CIRCLE INSIDE) or `#x2b59` (HEAVY CIRCLED SALTIRE)). The necessary fonts have all been installed and I am currently using the latest Emacs version on master which is 29.0.50. Any help with this is highly appreciated.
UPDATE:
SOLVED! Turns out that the issue I had was ridiculously easy to resolve but I learned a lot from the comments.
I have replaced
```lisp
(set-fontset-font t 'unicode "Noto Color Emoji" nil 'prepend)
```
by
```lisp
(set-fontset-font t 'emoji '("Apple Color Emoji" . "iso10646-1") nil 'prepend)
(set-fontset-font t 'symbol (font-spec :family "Symbola") nil 'prepend)
```
For posterity (and myself), here is my understanding of why that worked:
1. As u/alanthird pointed out, Noto Color Emoji currently does not work on macOS, so I switched to Apple Color Emoji for emojis instead. Instead of simply replacing the font string name I also had to include the `iso10646-1` registry part. This is described in [Emacs bug #54970](https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54970) which was filed and linked in the comments below by u/hmelman.
2. u/sr105 added that Symbola is a free font that contains `#x2b59`, so I switched to Symbola for symbols. Their comment got me thinking because ...
3. According to the [list of fonts supporting `#x2b59`](https://www.fileformat.info/info/unicode/char/2b59/fontsupport.htm) my font settings should never have worked to begin with - none of the fonts in my Emacs config were on that list. But why had this issue only occurred recently when migrating from Linux (at work) to macOS (at home)? My explanation is embarrassingly simple: on the Linux system I used until recently, I had never cared to check for other pre-installed fonts. It appears that one of those fonts was capable of displaying the special characters and that Emacs defaulted to it without me ever noticing.
Thank you to everyone who commented, this has been yet another valuable Emacs lesson.
hmelman · 2022-04-20 16:10
How are they displayed? You can use `set-fontset-font` to set a font for a particular character, just replace `'unicode` with `x2b57` and then use the font of your choice.
sr105 · 2022-04-20 16:15
Maybe you can put your cursor on the character and use `C-u M-x what-cursor-position` on macOS to tell you what font is being used to display the characters. That might give you some insight.
Oerm · 2022-04-20 16:25
I try to use them for prettier headlines in org-mode in combination with org-superstar. In the config part (where I use a fixed-pitch font), the chars are displayed as rectangular boxes with their respective code point inside. In an actual org file (with variable-pitch font), the chars are simply displayed as narrow rectangular boxes without any content. I had hoped that
(set-fontset-font t 'unicode "Noto Color Emoji" nil 'prepend)
would cover the entire symbols range, including `x2b57` and `x2b59` (EDIT: if possible I'd prefer a solution that does not require me to manually set the font of every single special character I use). I have also tried to replace `'unicode` with `'symbol` but to no avail.
EDIT2: Formatting
Oerm · 2022-04-20 16:38
I had not heard about `what-cursor-position` before, thank you for pointing this out. The outpout I get in the echo area and the messages buffer is
```
Char: ⭙ (11097, #o25531, #x2b59, file ...) point=50323 of 165543 (30%) column=44
```
where the part after "Char: " is displayed as a rectangular box with `2b59` inside.
Calling `describe-char` on the char in question yields:
```
position: 50323 of 165543 (30%), column: 44
character: ⭙ (displayed as ⭙) (codepoint 11097, #o25531, #x2b59)
charset: unicode (Unicode (ISO10646))
code point in charset: 0x2B59
script: symbol
syntax: _ which means: symbol
category: .:Base
to input: type "C-x 8 RET 2b59" or "C-x 8 RET HEAVY CIRCLED SALTIRE"
buffer code: #xE2 #xAD #x99
file code: #xE2 #xAD #x99 (encoded by coding system utf-8-unix)
display: no font available
Character code properties: customize what to show
name: HEAVY CIRCLED SALTIRE
general-category: So (Symbol, Other)
decomposition: (11097) ('⭙')
There are text properties here:
face (font-lock-string-face org-block)
font-lock-fontified t
font-lock-multiline t
fontified t
help-echo nil
line-prefix [Show]
src-block t
wrap-prefix [Show]
[back]
```
The `display: no font available` part is what is driving me crazy ...
sr105 · 2022-04-20 16:50
On my Windows machine, those characters seem to be provided by the font Segoe UI Symbol. On my minimal Linux Mint (Ubuntu) virtual machine, there are no fonts containing those two characters. Therefore, you're probably on the hunt for a free font to install that covers these characters. Interestingly, I couldn't find any resources on the web to tell you which fonts cover specific characters or to give a list of characters contained within a font which is rather frustrating. The closest thing I found is the following websites, but some of the fonts given as examples are lies.
[https://www.htmlsymbols.xyz/unicode/U+2B57](https://www.htmlsymbols.xyz/unicode/U+2B57)
[https://www.unicompat.com/2B57](https://www.unicompat.com/2B57)
[https://www.fontspace.com/unicode/char/2B57-heavy-circle-with-circle-inside](https://www.fontspace.com/unicode/char/2B57-heavy-circle-with-circle-inside)
sr105 · 2022-04-20 17:19
The Symbola font is marked as freeware and contains your symbols.
hmelman · 2022-04-20 17:47
I feel your pain, see [Emacs Bug 54970](https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54970). FWIW I'm using this to display emoji on macos right now.
(set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") nil 'prepend)
Edit: Oh and those boxes with codepoint numbers inside are referred to as tofu. It's a fallback display technique if Emacs can't find a font to display that character.
alanthird · 2022-04-21 09:01
As I understand it Noto Color Emoji doesn't work on macOS, so use Apple Color Emoji instead.
You also probably don't want to just blanket apply it to unicode, but to emoji and symbol only.
Oerm · 2022-04-21 13:07
That has pointed me in the right direction, thank you so much!
I've now switched to Apple Color Emoji for emojis (which I do not use often) and use Symbola for symbols. That works!
The [list of fonts](https://www.fileformat.info/info/unicode/char/2b59/fontsupport.htm) supporting `#x2b59` is suprisingly small so it would be interesting to know which font my old Linux system defaulted to without my knowledge. I will pay closer attention to this in the future.
Oerm · 2022-04-21 13:12
That was it ... the Linux system I used to work on must have defaulted back to another font (maybe Symbola, maybe Unifont) without me ever noticing. I was certain that Noto Color Emoji was taking care of displaying all these special characters but I was wrong.
Installing and switching to Symbola solved my issue thank you very much!