Free monospace font for 𝐀 etc

question

#1

I am looking for a free monospace font that supports the Unicode chars starting at #x1D400, eg 𝐀 (\bfA). I am using Iosevka for my main font in Emacs, just need it as a fallback for chars which are not available.


#2

DejaVu Sans Mono has them.

Edit: for the record, my mistake here arose from the fact that when one specifies a font in the Gnome character map application, it defaults to showing glyphs from other fonts.


#3

I don’t think so, at least version 2.37-1 (Ubuntu package) doesn’t (that glyph is empty). Where did you get yours?


#4

That’s strange; I have fonts-dejavu-core and fonts-dejavu-extra 2.37-1 on Debian and they look fine here.
Do you also have the -extra package?


#5

What are you using to determine that? Could be a fallback.

If you open /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf in eg fontforge, the glyph for #x1D400 is empty, and the same for almost all codepoints in the block.

In Emacs, use M-x describe-char to see which font provided the fallback.


#6

I think you’re right, although it looks like an extension rather than a fallback: emacs says

xft:-unknown-DejaVu Math TeX Gyre-normal-normal-normal-*-15-*-*-*-*-0-iso10646-1 (#x1EA)

which presumably comes from the fonts-texgyre package.


#7

Yes, that’s the default fallback (see M-x describe-fontset fontset-default). I am using DejaVu Serif as a fallback instead, which is also proportional but is more condensed.

Monospace support for Mathematical Alphanumeric Symbols seems to be nonexistent (apart from some low-quality fonts and GNU Unifont, which is a bitmap font).

I thought that Julia programmers are most likely to use these characters, which is why I asked here.


#8

Doing Math symbols in a monospaced font is hard, even commercial fonts don’t have this option.


#9

Possibly, but also the lack of demand (programming languages which allow a lot of Unicode in code). Julia is, again, ahead of most of the crowd here.

This is just a minor issue though, stuff does not align but I can live with this.


#10

I’m using D2coding for my editor.
It includes korean, english +additional 332 letters.


#11

Not sure why you suggested this font, as it does not seem to have any glyphs in the U+1D400–U+1D7FF range.


#12

I can find only a few fonts that have these characters (at least according to the handy UltraCharacterMap app.)

Asana and Stix look like good bets.

(I tried to get these output via Cairo.jl, but didn’t succeed, not sure why I can’t…)


#13

Can you provide example code?


#14

Yes, I’ll do that later today. I’ll try both the Toy API and the β€œother” API this time.

Edit

using Cairo

c = CairoRGBSurface(256,256)
cr = CairoContext(c)

save(cr)
set_source_rgb(cr,0.8,0.8,0.8)    # light gray
rectangle(cr,0.0,0.0,256.0,256.0) # background
fill(cr)
restore(cr)

# Toy API
select_font_face(cr, "Sans", Cairo.FONT_SLANT_NORMAL, Cairo.FONT_WEIGHT_BOLD)
#select_font_face(cr, "Asana-Math", Cairo.FONT_SLANT_NORMAL, Cairo.FONT_WEIGHT_BOLD)
set_font_size(cr, 30.0)
move_to(cr, 10.0, 110.0)
show_text(cr, string("1> ", Char(0x203d)))
move_to(cr, 10.0, 150.0)
show_text(cr, string("2> ", Char(0x1D400)))

# 'pro' API
set_font_face(cr, "Sans 16")
set_font_face(cr, "Asana-Math 16")
Cairo.text(cr, 100.0, 110.0, string("3> ", Char(0x203d)))
Cairo.text(cr, 100.0, 150.0, string("4> ", Char(0x1D400)))
Cairo.text(cr, 100.0, 180.0, "5> 𝐀")

write_to_png(c, "/tmp/sample_text.png")

sample_text

Yet another edit

Wait, it works if I specify the font name differently, not using its PostScript name (β€œAsana Math”). I wish I understood it all… Β―\_(ツ)_/Β― :slight_smile:


#15

I was about to write that. Your example looks like the interfaces work, but you miss to address the correct font. In the simple interface it looks like 203d is found and displayed, in the pango text the missing 1d400 is replaced by id-tag.

Finding fonts by name or similar is a nightmare on every architecture.

But i read you correctly: Asana Math contains the 1d400?


#16

Yes, using the β€œpro” API I could draw those characters specifying the correct font β€œAsana Math”:

sample_text

The β€œtoy” API draws 203d only if I specify β€œAsanaMath”. :slight_smile:


#17

You could raise a question like this on the https://groups.google.com/forum/#!forum/googlefonts-discuss
Google tries/tried hard to achieve good unicode coverage on the fonts they support, maybe you raise some interest by a designer to work on that.


#18

Great idea, I posted there and will link it here once it clears moderation.


#20

I have Symbola as a fallback, it does 𝐀 (\bfA) just fine. I also need to set a wide letter space to see them.