+0
日增长
5,709
stars
153
forks
79
watchers
32
prs
109
issues
9
releases
README
Hasklig – _Ligatures for code_
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 use lhs2tex 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 the ghc. However they are one-character-wide and therefore eye-strainingly small. Furthermore, when displayed as substitutes to the underlying multi-character representation, as vim2hs 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.
Hasklig
!Hasklig Sample
Source Code Pro
!Source Code Pro Sample
Currently implemented symbols
!! || === == < +++ = = =- -- ++ /= ==
Building the fonts from source
Requirements
To build the binary font files from source, you need to have installed the
Adobe Font Development Kit for OpenType (AFDKO). The AFDKO
tools are widely used for font development today, and are part of most font
editor applications.
Some SVG glyphs are inserted into the fonts using Python FontTools.
Building font instances from masters
This repository only includes so-called master weights of the fonts (effectively extralight and black).
The shapes of the weights in between these extremities are calculated by makeInstancesUFO supplied with .designspace files.
For convenience, the shell script makeInstances is provided, which executes makeInstancesUFO, calculating all the italic and regular font weight shapes.
sh
$ ./makeInstances.sh
Building one font
The key to building OTF or TTF fonts is makeotf, which is part of the AFDKO toolset.
Information and usage instructions can be found by executing makeotf -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:
sh
$ cd Roman/Regular/
$ makeotf -r
Building all fonts
For convenience, a shell script named build is provided in the root directory.
It builds all OTFs and TTFs, and can be executed by typing:
sh
$ ./build.sh
or this on Windows:
sh
build.cmd
Credits
Original idea, design and implementation of code ligatures by Ian Tuomi 2014-2015.
This typeface extends Source Code Pro with ligatures.Top issues
#10State of Hasklig for emacs?27 comments · 2014-12-08#51Ligature request: !=19 comments · 2016-03-30#12Requesting even more ligatures18 comments · 2015-01-20#84works for emacs15 comments · 2017-04-26#124λ to indicate anonymous functions13 comments · 2020-11-27#95Ligatures for != <= >= !%% #! && ''' 12 comments · 2017-09-17#43Request: ligatures for != and !==9 comments · 2016-02-22#78/= ligature doesn't work well for Ruby7 comments · 2016-10-21
Latest release
v1.2 v1.2 2020-12-22Include latest changes from the Source Code Pro repository master branch (https://github.com/adobe-fonts/source-code-pro/commit/14875b70293e83159ad85c7d9d9081e76403d1e3) The Source Code Versions Hasklig v1.2 is based on are: - Roman 2.032 - Italic 1.052 - Variable _not supported_ Most notably, this update resolves https://github.com/i-tu/Hasklig/issues/123 Huge thanks to @pkq for looking into this issue in detail and kicking the ball off.