1

How can I make 𝐒(U+1d412), 𝐽(U+1d43d), and 𝑁(U+1d441), which I can display clearly in my browser, show in the terminal?

I use Urxvt on Archlinux.

The ~/.Xdefaults file has this content:

URxvt*foreground:       #ffffff
URxvt*background:       #000000
URxvt*font:             xft:DejaVuSansMono Nerd Font Mono:size=12
URxvt*cursorBlink:      true
URxvt*scrollBar:        false
URxvt*scrollTtyOutput:  false
URxvt*saveLines:        50000
URxvt*scrollWithBuffer: true
URxvt*scrollTtyKeypress:true
URxvt.perl-ext-common:  resize-font
URxvt*color4:           #265997
URxvt*color12:          #3F6FD0

I know I have to change its 3rd line, but I don't how to know which font can show those symbols, nor if I have it already installed.

I know that the present question is (almost?) a duplicate of a similar question I asked a couple of years ago, however to be honest I'm still totally ignorant on this matter, and none of those answers really gave me a deterministic way to solve the problem of which font I need to install.

At the Font page of Archlinux wiki I read:

List installed fonts for a particular Unicode character

To search for monospace fonts supporting a particular Unicode codepoint:

fc-match -s monospace:charset=hex-code

and doing so for the 3 unicodes above gives several results on my system, however I don't know how I should update my ~/.Xdefaults.


For now, what I've tried has been changing the line URxvt*font: xft:DejaVuSansMono Nerd Font Mono:size=12 and see what happens.

In fact, I've discovered that I can try out fonts live in the terminal without changing the configuration above by just entering printf '\e]710;%s\007' "xft:font-name:pixelsize=12", so I've done so for several font-names, which I've chosen from fc-list's output, by picking the text between the first and second (i.e. last) :, e.g. since fc-list has this line

/usr/share/fonts/TTF/Meslo LG L DZ Regular Nerd Font Complete Mono.ttf: MesloLGLDZ Nerd Font Mono:style=Regular

I've entered

printf '\e]710;%s\007' "xft:MesloLGSDZ Nerd Font Mono:pixelsize=12"
cat a-file-with-those-three-glyphs-in-it

but I keep seeing the boxes meaning the characters can't be shown.

5
  • Does the post here from thisoldman hep?
    – frabjous
    Mar 25, 2022 at 23:29
  • @frabjous, no, it doesn't help me. Or, at least, I don't understand how. I've tried, for instance, to give more than one font to URxvt*font, but that doesn't help.
    – Enlico
    Mar 25, 2022 at 23:56
  • What fonts did you try? For me, 𝐒 and 𝐽 worked with any other fonts I tried with those glyphs as fallback, but 𝑁 only worked with a couple URxvt*font:xft:DejaVuSansMono Nerd Font Mono:size=12,xft:Libertinus Math:size=12 and URxvt*font:xft:DejaVuSansMono Nerd Font Mono:size=12,xft:Sarasa Term K:size=12; I used your .Xdefaults (or other Sarasa variant) as is otherwise.
    – frabjous
    Mar 26, 2022 at 0:20
  • After some more tests. Noto Sans Math, FreeSerif and Asana Math also worked.
    – frabjous
    Mar 26, 2022 at 0:27
  • I just tested with konsole. It all works. Mar 26, 2022 at 10:55

1 Answer 1

2

All of the symbols you're using are from the Mathematical Alphanumeric Symbols block. You're using the DejaVu font. From the wikipedia page about DejaVu, it supports only 12% of the Mathematical Alphanumeric Symbols block. You need to change the font if you want to display those characters. If you only want to display those three characters, you can use fc-list to find fonts installed on your system like so:

fc-list ':charset=1d412 1d43d 1d441'

Unfortunately there is no good solution for finding characters in all fonts present in the package manager.

But if you can view the characters in your browser and not in the terminal, you should have a font that supports the character because browsers usually don't have their own fonts. If you're on Firefox, use the Inspector tool to select the element that's rendering the character and click on Fonts in the rightmost corner of the tool to view what fonts are being used.

1
  • Take for instance 𝔹, which is U+1D539. I can see it in my browser. If I use chrome devtools to inspect that character at the beginning of this very comment, I'll see that for that element font-family is computed to be ui-monospace, "Cascadia Mono", "Segoe UI Mono", "Liberation Mono", Menlo, Monaco, Consolas, monospace, so I would assume one of those listed does the trick. However, when putting xft:FFF:size=12 in my .Xdefaults with FFF being any single one of Cascadia Mono, Segoe UI Mono, and so on, none of them was able to make 𝔹 show in the terminal (yes, newly open).
    – Enlico
    Oct 22, 2022 at 7:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .