Flatworm is a monospace font for coding, focused on scannability, compactness, legibility at small sizes, and a limited set of non-intrusive ligatures.
The base of this font was adapted from the Ubuntu Mono font, but it takes inspiration and good ideas from Mononoki, Menlo, and Geist as well to create a font that is highly readable but familiar.
The evolution that this font represents is largely in its symbols, as well as in some impactful changes to some of the letters and spacings to increase their distinctiveness at small sizes or reduce the extent to which they cause visual breakup in words. This font also adds precisely three ligatures for the common types of "arrow" symbols that used in many languages.
The philosophy behind developing the ligatures was that these symbols can make a codebase look less needlessly noisy when they are used - allowing the eye to be drawn more naturally to the information around them - and enhance the visual semantics of the code. The arrow ligatures formed from ->
=>
and <-
can also be designed such that it is not unclear what symbols they are composed of. More extensive ligature support, however, tends to make code less clear and more cumbersome to read, as glyphs like those of =
, ==
, ===
, and many others can be frustratingly similar at a glance when too many ligatures are introduced. One of the motivations for this project in the first place was to create a font with support for only the core arrow ligatures, and nothing more. It is ultimately a matter of taste, but I an very happy with the balance struck by this font, and I think that you will be as well.
-
Highly legible at small font sizes (great for fitting lots of code on-screen at once) or long viewing distances (useful for showing others your code)
-
Small glyphs relative to font point (you may wish to increase your font size for comfort)
-
Horizontally compact column width
-
Consistent style between italic and regular glyphs
-
Exactly Three Ligatures for arrows
-
Primarily sans-serif
-
Angular uppercase and rounded lowercase letters
-
Nerd Font Symbols package
-
Big round parenthesis (my personal favorite)
-
Curvy curly braces (clearer at small sizes and lower relative resolutions)
-
Braces and parenthesis are of uniform height
-
Tall open angle-brackets
-
Vertically elevated asterisk and circumflex
-
Vertically centered brackets and symbols (with the exception of the above)
-
Round punctuation points
-
Tapered quotes and tic marks
-
Serifs on i, j, t, and l glyphs
-
Slashed zeroes
-
Elevated middle hump on lowercase M
Example:
per glyph diff from Ubuntu Mono:
Download the Flatworm_NF_mono.otf file for the font and add it to your system's fonts, which will be different depending on your OS.
-
for most Linux distros, add the installed font to your
~/.local/share/fonts
directory, and then update the font cache by runningfc-cache -fv
-
for Mac OS, add the font to your font book by opening the Font Book app, and then selecting file > Add Fonts To Current User, and then selecting the downloaded font file.
-
for windows, simply add the file to your
C:\Windows\Fonts
folder.
If you have a program that requires using the older TrueType font format for compatibility (for example, to support ligatures in that program) then you can download Flatworm_NF_mono.ttf for that.
To modify and extend the font yourself, you can clone the repo and open flatworm_NF_mono_source.sfd in a font editing CAD software of your choice, such as FontForge (which was used to create this font).
NOTE: To generate your own diff images with the render_diffs.sh script, you will need to have imagemagick installed.
Once you have that, you can generate a diff image between any two fonts on some sample text by running:
render_diff.sh <font_file_A> <font_file_B> <sample_text_file>
for example:
render_diff.sh UbuntuMono.ttf Flatworm_NF_mono.ttf sample.txt
*note that the render process does not account for ligatures - only raw glyphs
Reference for the Licensing rules for the font license: https://ubuntu.com/legal/font-licence
If you'd like to read a compelling case against ligatures in programming fonts, take a look at this concise argument by Matthew Butterick. Of course, my hubris has led me to believe that I can do it anyway, but I am not unaware of the criticism and consider my attempt here to be more in-dialog with the idea than opposed to it.