# Fira Code Font and Ligatures for Julia

#1

The Fira Code font (https://github.com/tonsky/FiraCode) just got some more Julia specific ligatures! I think some of them are pretty neat.

#2

Thanks, this is awesome! Works in iTerm2 in my VIM without any problems…

#3

doesn’t work in emacs though , at least not without a hack: https://github.com/tonsky/FiraCode/issues/211#issuecomment-239087391

#4

there exist ligatures for .= and .-, where can I get a complete list of infix and unary operators?

#5

Fira Code is my goto font, and it’s great. One weakness for Julia coders is the inconsistent ligatures for dotted operators, e.g. .- vs .+, which is a bit of a wart:

Also, ligatures don’t seem to work in the new Juno REPL, while they do work in the ordinary terminal REPL on MacOS.

#6

I was going to open an issue because of that, I just need a complete list.

#7

does it work with the hack though?

#8

Upstream issue, in case you want to track it:

#9

Haven’t tried it myself, but apparently it works partially.

#10

maybe offtopic on offtopic: Is there a linux/X11 (or wayland) counterpart of iTerm2?

#11

What feature(s) do you need specifically? Looking at their list, most of it is done by a collection of tools, eg tmux (in any terminal emulator, I use xfce4-terminal).

#12

There are a lot of them… Julia allows dots to prefix nearly all binary operators, which includes a large number of Unicode characters. See all of the operators grouped under (add-dots ....) here:

In addition to that, you can also use these operators with combining characters (dots, hats, macrons, etc).

The most important ones are probably the dottable operators with a built-in definition in Base:

= += -= *= /= //= |\\=| ^= ÷= %= <<= >>= >>>= \= &= ⊻=
> < >= ≥ <= ≤ == === ≡ != ≠ !== ≢ ∈ ∉ ∋ ∌ ⊆ ⊈ ⊂ ⊄ ⊊ ≈ ≉
+ - | ⊻
<< >> >>>
* / ÷ % & ⋅ ∘ × \ ∩
// ^


(Some of these operators, like ≉ and ≢, don’t even have glyphs without dots in common fonts, e.g. the font I’m seeing in my browser right now. Also, some fonts mess up operators with combining characters, e.g. +̂ is not combined in many fonts.)

You might also want a ligature for .( for dotted function calls like f.(x).

#13

I’m not sure that the ligatures for dotted operators are such a great idea, though. For example, how would .⋅ appear if you defined a ligature similar to the one you have for .-? The raised dot in your ligature looks an awful lot like a multiplication operator.

Note also that <<= is an assignment operator in Julia and many other languages, and the current ligature doesn’t reflect this (https://github.com/tonsky/FiraCode/issues/560).

The other problem I have when looking at some of these ligatures is that if I’m looking at someone’s code and see a non-obvious ligature, I might not know how to type it. My first guess would be that it is some Unicode character (Julia supports a lot of those and they are common in Julia code), not a ligature.

Note also that -> => ⟶ ⟹ are all distinct operators in Julia. It seems that your ligatures make the first two look very similar to the latter two, which is a problem. (Filed https://github.com/tonsky/FiraCode/issues/559) This illustrates the general danger of mixing fancy ligatures with a language that supports both ASCII and Unicode operators.

#14

I have very little knowledge about ligatures and how the substitution actually works. I know that there are switches called font features that can turn on and off certain ligatures, it would probably make sense to have a julia font feature that is aware of these things.

Looking at all the possible operators in Julia it is possible to write really confusing code only by using similarly looking Unicode operators.

#15

thanks for pointing me there!

#16

I have a related question: Does anyone know a Windows ttf monospace font, which can display the most basic Julia Unicode characters, like \xor, \euler, \in… in the REPL? It is quite sad, that these are only shown by 2 otherwise terribly looking standard Windows fonts: MS Gothic and NSimSun. (MS Gothic even replaces ‘\’ with a crossed over ‘Y’.)

#17

usually I’m working in Juno and unicode is displayed fine (inline and in REPL)

On windows, a solution for a standalone command line is to use conemu/cmder, and set a font under “Alternative Font” which is used for unicode glyphs.

I’ve found that http://unifoundry.com/unifont/index.html has all the things.

#18

Thanks, Alan. Unifont as alternative font works in ConEmu! Unfortunately, it seems to be a low resolution raster font, and so some glyphs are not recognizable, but it has all the symbols I need.

I keep on looking for nicer, truly scalable fonts, and would appreciate more suggestions.

#19

…I found FreeMono: http://www.fontspace.com/gnu-freefont/freemono. It has much fewer glyphs, but the included ones are beautiful.