- Notifications
You must be signed in to change notification settings - Fork153
Hasklig - a code font with monospaced ligatures
License
i-tu/Hasklig
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Programming languages are limited to relatively few characters. As a result, combined character operators surfaced quite early, such as the widely used arrow (->
), comprised of a hyphen and greater sign. It looks like an arrow if you know the analogy and squint a bit.
Composite glyphs are problematic in languages such as Haskell which utilize these complicated operators (=>
-<
>>=
etc.) extensively. The readability of such complex code improves with pretty printing. Academic articles featuring Haskell code often uselhs2tex to achieve an appealing rendering, but it is of no use when programming.
Some Haskellers have resorted to Unicode symbols (⇒
,←
etc.), which are valid in theghc. However they are one-character-wide and therefore eye-strainingly small. Furthermore, when displayed as substitutes to the underlying multi-character representation, asvim2hs does, the characters go out of alignment.
Hasklig solves the problem the way typographers have always solved ill-fitting characters which co-occur often:ligatures. The underlying code stays the same — only the representation changes.
Not only can multi-character glyphs be rendered more vividly, other problematic things in monospaced fonts, such as spacing can be corrected.
<*
<*>
<+>
<$>
***
<|
|>
<|>
!!
||
===
==>
<<<
>>>
<>
+++
<-
->
=>
>>
<<
>>=
=<<
..
...
::
-<
>-
-<<
>>-
++
/=
==
To build the binary font files from source, you need to have installed theAdobe Font Development Kit for OpenType (AFDKO). The AFDKOtools are widely used for font development today, and are part of most fonteditor applications.
Some SVG glyphs are inserted into the fonts using PythonFontTools.
This repository only includes so-calledmaster weights of the fonts (effectively extralight and black).The shapes of the weights in between these extremities are calculated bymakeInstancesUFO
supplied with.designspace
files.For convenience, the shell scriptmakeInstances is provided, which executesmakeInstancesUFO
, calculating all the italic and regular font weight shapes.
$ ./makeInstances.sh
The key to building OTF or TTF fonts ismakeotf
, which is part of the AFDKO toolset.Information and usage instructions can be found by executingmakeotf -h
.
In this repository, all necessary files are in place for building the OTF and TTF fonts.For example, build a binary OTF font for the Regular style like this:
$cd Roman/Regular/$ makeotf -r
For convenience, a shell script namedbuild is provided in the root directory.It builds all OTFs and TTFs, and can be executed by typing:
$ ./build.sh
or this on Windows:
> build.cmd
Original idea, design and implementation of code ligatures by Ian Tuomi 2014-2015.This typeface extendsSource Code Pro with ligatures.
About
Hasklig - a code font with monospaced ligatures