1
1
mirror of https://github.com/i-tu/Hasklig.git synced 2024-07-04 14:06:27 +03:00
Hasklig - a code font with monospaced ligatures
Go to file
Ian Tuomi 5344dc892c
Merge pull request #128 from GerardVivancos/main
Updated Readme.md to point to the correct makeInstances script
2021-02-12 10:12:07 +02:00
docs CSS: implement Variable Fonts where supported 2020-11-11 14:28:33 +01:00
emoji Preserving emoji work before branching and resetting this current branch. 2015-07-07 10:47:52 -07:00
Italic Merge old master 2020-12-22 23:01:56 +02:00
Roman Merge old master 2020-12-22 23:01:56 +02:00
.gitignore Merge old master 2020-12-22 23:01:56 +02:00
addSVGtable.py Remove unused import 2019-10-04 10:33:51 -07:00
all.rtf V1.1: 6 new ligatures, new substitution mechanism, fixed ++/+++ 2017-01-22 12:31:13 +02:00
build.cmd Merge old master 2020-12-22 23:01:56 +02:00
build.sh Merge old master 2020-12-22 23:01:56 +02:00
buildVFs.sh Source Code Pro, Roman 2.032, Italic 1.052 Variable 1.012 2020-10-22 15:52:56 +11:00
CHANGELOG.md Remove compatibility list, split changelog into own file 2021-01-05 12:09:28 +02:00
familyGPOS.fea Move features.fea files inside the UFOs 2017-07-25 13:40:30 -07:00
familynameIDs.fea Refactor name table FEA 2017-07-25 08:56:00 -07:00
familyOS2.fea rrefactoring of feature files 2017-01-21 10:39:26 -08:00
familyTables.fea Merge old master 2020-12-22 23:01:56 +02:00
familyWidthsAdjust.fea rrefactoring of feature files 2017-01-21 10:39:26 -08:00
features.fea Merge old master 2020-12-22 23:01:56 +02:00
featuresVar.fea Fixes to include() paths 2019-06-07 01:34:25 -07:00
FontMenuNameDB Merge old master 2020-12-22 23:01:56 +02:00
gen_calt.clj V1.1: 6 new ligatures, new substitution mechanism, fixed ++/+++ 2017-01-22 12:31:13 +02:00
hasklig_example.png Bring back screenshots 2021-01-05 12:02:53 +02:00
index_to_resources.txt Preserves changes previous to Miguel’s push. In the middle of adding triangular bullets. 2015-06-04 18:27:09 -07:00
LICENSE.md Update LICENSE 2019-09-05 16:49:32 -07:00
ligatures.fea V1.1: 6 new ligatures, new substitution mechanism, fixed ++/+++ 2017-01-22 12:31:13 +02:00
makeInstances.sh Merge old master 2020-12-22 23:01:56 +02:00
README.md Updated Readme 2021-02-10 17:29:11 +01:00
relnotes.txt Source Code Pro: Roman 2.032, Italic 1.052, VAR 1.012 2020-11-17 12:53:00 +11:00
SourceCodeProSample.png Bring back screenshots 2021-01-05 12:02:53 +02:00
uvs.txt Add text representation Emoji Variation Sequences (EVSes) 2019-07-15 22:34:15 -07:00

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.

$ ./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:

$ 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:

$ ./build.sh

or this on Windows:

> build.cmd

Credits

Original idea, design and implementation of code ligatures by Ian Tuomi 2014-2015. This typeface extends Source Code Pro with ligatures.