Want more Unicode sub/superscripts? Need volunteer font designers

One of the nice little things about Julia programming has been the broad support for Unicode identifiers — variables like α̂₂′ and operators like . However, a common source of frustration is the paucity of available subscripts and superscripts — there is no superscript “q” or subscript “A”, much less superscript “*” or “†”, in Unicode.

On the back burner for a few years now, a few of us have been bouncing around the idea of proposing that Unicode expand its set of subscripts and superscripts by adding new “mathematical sub/superscript” combining characters. See our draft proposal here, which is now nearing the the point of formal submission: https://github.com/stevengj/subsuper-proposal

One sticking point is that proposals are required to include the name and contact information for a company or individual who would agree to provide a computerized font (True Type or PostScript) for publication of the standard. Can we crowdsource this?

Basically, we need to find volunteers with font-design experience, who, if the proposal is accepted, will create font with the needed characters. In principle, this is as simple as taking a free font like DejaVu Sans Mono, making sub/superscript versions of 100–150 common mathematical glyphs (Latin and Greek characters and a few other symbols), and then adding ligatures so that the new glyphs are used when the corresponding character+combining-character combination is encountered.

20 Likes

I believe @cormullion has mentioned in the past an interest in prototyping this in julia mono’s private use area.

I’ve already contributed to that repository.

6 Likes

In general for activities like this, i’d recommend to use the UFO format https://unifiedfontobject.org/ and tool chains like https://github.com/googlefonts/ufo2ft

1 Like

While there’s a proposal, would it make sense to include overscript and underscript combiners?

2 Likes

I couldn’t resist trying out the subscripted x’s listed in the Wikipedia page:

#x₁	x₂	x₃	x₄	x₅	x₆	x₇	x₈	x₉
#xₐ	xₑ	xₒ	xₓ	xₔ	xₕ	xₖ	xₗ	xₘ	xₙ	xₚ	xₛ	xₜ	

x₀ = 7
x₁ = 3
x₂ = 2

xₙ = x₀ + 5x₁ + 3x₂^2

println("xₙ = ",xₙ)

Heh, with a little more digging, I see you can type them into the REPL and VS Code as follows:

subscripts:

julia> x\_1<tab>
julia> x₁ 

Similarly, for superscripts, use ^1 – or whatever character or letter you want to super/sub script.

Works with more characters in VS Code than in the REPL.

By the way, all the superscripts and subscripts mentioned in Professor Johnson’s proposal are currently available in the JuliaMono font; they live in a Private Use Area, starting at 0xf0000.

You can display them in string form with:

for c in 0xf0000:0x20:0xf011f
    print("$(string(c, base=16))  ")
    for c1 in c:c + 0x1f
        print("x$(Char(c1)) ")
    end
    println()
end

Of course, this isn’t useful if you want to see your code in its full glory on Github, or indeed anywhere else unless the same font is active. And you can’t use them in Julia variable names, either, because … they’re not valid Unicode glyphs. :slight_smile:

Hence, the proposal…

1 Like

chrome://settings/fonts may be useful for customizing browser fonts.