Hasklig - a code font with monospaced ligatures

Overview

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.

Comments
  • Readme is outdated - MacVim now as optional support for ligatures.

    Readme is outdated - MacVim now as optional support for ligatures.

    I think the title says it all - I worked on a PR which recently got merged into mainline MacVim which enables ligature support for the CoreText renderer :smile_cat:

    opened by Shirk 23
  • No color on macOS Big Sur

    No color on macOS Big Sur

    • https://github.com/adobe-fonts/source-code-pro/issues/250
    • https://github.com/microsoft/vscode/issues/100840
    • https://bugs.chromium.org/p/chromium/issues/detail?id=1100502
    opened by balupton 22
  • VS Code not picking up Hasklig's ligatures. While KDevelop and KDE's font config utility do.

    VS Code not picking up Hasklig's ligatures. While KDevelop and KDE's font config utility do.

    As per the title. Do I need to take extra steps to get Hasklig working in VS Code?

    VS Code not picking up Hasklig's ligatures. But the font is changed to Source Code Pro. And also showing KDE's font config utility picking up Hasklig's ligatures without any issues.

    hasklig-font-not-working-correctly-in-vscode_20161119_120623

    On the exact same box, simultaneously, KDE's KDevelop is picking up Hasklig's ligatures without any issues.

    hasklig-font-working-correctly-in-kdevelop_20161119_121105

    Edit: And KWrite and Kate (also on the exact same box) picking up Hasklig's ligature's correctly.

    hasklig-font-working-correctly-in-kwrite-and-kate_20161119_123529

    opened by BobbyBabes 22
  • Use contextual alternates instead of ligatures

    Use contextual alternates instead of ligatures

    This would enable cursor positioning "inside" ligatures in atom (see this and this). Would also help with #18.

    I really love hasklig but the unintuitive insertion point behavior around the combination glyphs sends me back to plain Source Code Pro. :cry:

    Thanks for making Hasklig! :heart:

    opened by idan 9
  • No full support by Atom?

    No full support by Atom?

    I tried setting up this font in Atom, and after I disabled hardware acceleration and added body { text-rendering: optimizeLegibility; to my css configuration, it seemed to work, but the cursor shows up in the wrong place (and it gets worse the more ligatures you have in a line). The cursor shown here is actually at the end of the line:

    screenshot from 2014-11-16 23 32 11

    I just want to clarify if Atom has been able to use the font with full support before in a different config/version/system. I'm using the current version 0.146.0 on Ubuntu 14.04.

    application support 
    opened by cobalamin 9
  • 'makeInstancesUFO: command not found' when trying to build the font

    'makeInstancesUFO: command not found' when trying to build the font

    I try to build the font using Ubuntu on WSL, but I encounter the problem in the title.

    What I've done

    I have installed afdko and fonttools using pip3 install afdko fonttools and ran the ./buildInstances.sh command which resulted in:

    [email protected]:/mnt/c/Users/cdrozak/Projects/Hasklig$ ./buildInstances.sh
    ./buildInstances.sh: line 1: makeInstancesUFO: command not found
    ./buildInstances.sh: line 2: makeInstancesUFO: command not found
    

    When I changed makeInstancesUFO to lowercase, I got the following response:

    [email protected]:/mnt/c/Users/cdrozak/Projects/Hasklig$ ./buildInstances.sh
    ERROR:afdko.makeinstancesufo:No axes defined
    ERROR:afdko.makeinstancesufo:No axes defined
    
    opened by nawordar 6
  • Update README URLs based on HTTP redirects

    Update README URLs based on HTTP redirects

    Created with https://github.com/dkhamsing/frankenstein

    GitHub Corrected URLs

    | Was | Now | | --- | --- | | https://github.com/Lokaltog/powerline | https://github.com/powerline/powerline | | https://github.com/adobe/source-code-pro | https://github.com/adobe-fonts/source-code-pro |

    HTTPS Corrected URLs

    | Was | Now | | --- | --- | | http://en.wikipedia.org/wiki/Typographic_ligature | https://en.wikipedia.org/wiki/Typographic_ligature | | http://www.andres-loeh.de/lhs2tex/ | https://www.andres-loeh.de/lhs2tex/ |

    opened by ReadmeCritic 6
  • Doesn't work with Chromium 41 / NW.js 0.12.x

    Doesn't work with Chromium 41 / NW.js 0.12.x

    While Hasklig ligatures work, if you toggle text-rendering: optimizeLegibility (needed for ligatures) on NW.js 0.12.x, which is using embedded Chromium 41.0.2272.76, the line-length of the "monospaced" font changes. text-rendering: geometricPrecision has the same error.

    See: https://github.com/Crunch/Crunch-2/issues/39

    This is probably why support has been difficult for Chromium-based editors like Atom. The Hasklig font simply doesn't render as a monospace font.

    opened by matthew-dean 6
  • Request: Slashed zero version

    Request: Slashed zero version

    Just that, really. :smile:

    I really like Hasklig, but for some reason I can't stomach the dotted zero, so I was wondering if you'd consider adding a version with it slashed, kind of like what Meslo LG does.

    Thanks.

    opened by cobrabr 5
  • Ligature from rust unit type () to empty set ∅

    Ligature from rust unit type () to empty set ∅

    Ideally should only happen after a comma, open parenthesis or space, or never after an alphanumerical character:

    foo(); foo(∅); foo(bar, ∅); ∅

    Other rust ligatures could be

    &[ r#" foobar "

    opened by lgarczyn 4
  • Ligatures in IntelliJ

    Ligatures in IntelliJ

    Intellij Idea now supports ligatures http://blog.jetbrains.com/idea/2016/06/intellij-idea-2016-2-eap-case-only-renames-in-git-ligatures-background-images-and-more/

    opened by gAmUssA 4
  • error on makeInstances.sh

    error on makeInstances.sh

    The script with is called on makeInstances.sh is makeInstancesUFO. But the name of the script is makeinstacesufo, so it must either be changed to makeInstancesUFO or makeintancesufo in makeInstances.sh.

    opened by userunknownn 0
  • Get weird h symbol with `l l` when ligatures are disabled.

    Get weird h symbol with `l l` when ligatures are disabled.

    I'm using vscode with Hasklig as the font. But for languages other then Haskell I have disabled ligatures.

    When using Haskell I have no problems. But when using non-Haskell it works fine for the most part but any l l in the text is rendered as a weird double l symbol. See the gif.

    https://user-images.githubusercontent.com/7439756/152345946-fc1c9993-5db0-4f17-9d97-46611fa7c631.mp4

    I'm unsure what the issue is. Or whether it's Hasklig or vscode or even some weird config on my end.

    opened by rowanG077 0
  • Any reason not to or plan to release the webfonts version of it?

    Any reason not to or plan to release the webfonts version of it?

    Hi everyone!

    I like this font so much that I'm using also as the desktop interface font for my Linux systems, not just as the font for the coding parts.

    Now, I'd like to use it for my web presentations (ok, locally still doable with otf/ttf) and web blog. As I couldn't find any woff and/or woff2 version of it, nor another reference about it in the issues, I am asking here: any reason not to OR plan to release the webfonts version of it :grey_question:

    Thanks.

    opened by dxps 0
  • Build debian support

    Build debian support

    This PR addresses a couple of small build issues I had while attempting to build Hasklig (environment dump below). These changes shouldn't affect the current build process but should expand build support to Linux systems.

    1. Build scripts are now executed under the BASH runtime rather than SH. image

    2. makeInstances.sh supports the case-sensitive version of 'makeinstancesufo'. image

    Environment Dump:

      Operating System: Ubuntu 21.04
                Kernel: Linux 5.11.0-38-generic
          Architecture: x86-64
    
    opened by wholesome-wiz 0
  • Italic and others not monospaced, according to fontconfig.

    Italic and others not monospaced, according to fontconfig.

    Thanks in advance. Forgive me if I've missed something silly.

    I just downloaded a zip of the 1.2 release and tried to use it with Kitty terminal, which only uses monospace fonts. Long-story-short, it seems that the italic face is failing fontconfig's test for monospace font:

    > fc-list : family spacing outline scalable | grep -i "hasklig"Hasklig:spacing=100:outline=True:scalable=True
    Hasklig:outline=True:scalable=True
    Hasklig,Hasklig Black:spacing=100:outline=True:scalable=True
    Hasklig,Hasklig Semibold:spacing=100:outline=True:scalable=True
    Hasklig,Hasklig Light:outline=True:scalable=True
    Hasklig,Hasklig Semibold:outline=True:scalable=True
    Hasklig,Hasklig Light:spacing=100:outline=True:scalable=True
    Hasklig,Hasklig Medium:outline=True:scalable=True
    Hasklig,Hasklig Medium:spacing=100:outline=True:scalable=True
    Hasklig,Hasklig ExtraLight:spacing=100:outline=True:scalable=True
    

    Or likewise:

    > fc-list :mono family | grep -i "hasklig"
    Hasklig
    Hasklig,Hasklig Black
    Hasklig,Hasklig Light
    Hasklig,Hasklig Semibold
    Hasklig,Hasklig Medium
    Hasklig,Hasklig ExtraLight
    

    I don't know anything about fonts, but it looks like fc uses some property called 'advances' to rule a font FC_MONO? So if the advances of each glyph are all "approximately equal" then the font is monospace: https://github.com/behdad/fontconfig/blob/5b41ded2b0ddb98a07ac86264b94403cb7a0fd82/src/fcfreetype.c#L2348

    I'm not even sure this is a bug, but let me know if I can help.

    opened by timtro 0
Releases(v1.2)
Owner
Ian Tuomi
Ian Tuomi
Ingest openldap data into bloodhound

Bloodhound for Linux Ingest a dumped OpenLDAP ldif into neo4j to be visualized in Bloodhound. Usage: ./ldif_to_neo4j.py ./sample.ldif | cypher-shell -

Guillaume Quéré 71 Nov 09, 2022
Small Arrow Vortex clipboard processing library

Description Small Arrow Vortex clipboard processing library. Install You can install this library from PyPI with pip install av-clipboard-lib or compi

Delta Epsilon 1 Dec 18, 2021
Research using python - Guide for development of research code (using Anaconda Python)

Guide for development of research code (using Anaconda Python) TL;DR: One time s

Ziv Yaniv 1 Feb 01, 2022
Pygments is a generic syntax highlighter written in Python

Welcome to Pygments This is the source of Pygments. It is a generic syntax highlighter written in Python that supports over 500 languages and text for

1.2k Jan 06, 2023
Discovering local read-level DNA methylation patterns and DNA methylation heterogeneity in intermediately methylated regions

Discovering local read-level DNA methylation patterns and DNA methylation heterogeneity in intermediately methylated regions

1 Jan 11, 2022
This is a simple analogue clock made with turtle in python...

Analogue-Clock This is a simple analogue clock made with turtle in python... Requirements None, only you need to have windows 😉 ...Enjoy! Installatio

Abhyush 3 Jan 14, 2022
a wordle-solver written in python

Wordle Solver Overview This is yet another wordle solver. It is built with the word list of the official wordle website, but it should also work with

Shoubhit Dash 10 Sep 24, 2022
LinkScope allows you to perform online investigations by representing information as discrete pieces of data, called Entities.

LinkScope Client Description This is the repository for the LinkScope Client Online Investigation software. LinkScope allows you to perform online inv

108 Jan 04, 2023
Purge all transformation orientations addon for Blender 2.8 and newer versions

CTO Purge This add-on adds a new button to Blender's Transformation Orientation panel which empowers the user to purge all of his/her custom transform

MMMrqs 10 Dec 29, 2022
Análise do Aplicativo Prévias PSDB 2021

Análise do Aplicativo Prévias PSDB 2021 Com a recente polêmica sobre o aplicativo usado nas Prévias do PSDB de 2021, fiquei curioso para saber como er

Paulo Matias 18 Jul 31, 2022
A competition for forecasting electricity demand at the country-level using a standard backtesting framework

A competition for forecasting electricity demand at the country-level using a standard backtesting framework

5 Jul 12, 2022
A program that makes all 47 textures of Optifine CTM only using 2 textures

A program that makes all 47 textures of Optifine CTM only using 2 textures

1 Jan 22, 2022
An osu! cheat made in c++ rewritten in python and currently undetected.

megumi-python An osu! cheat made in c++ rewritten in python and currently undetected. Installation Guide Download python 3.9 from https://python.org C

Elaina 2 Nov 18, 2022
Contains the code of my learning of Python OOP.

OOP Python This repository contains the code of my learning of Python OOP. All the code: is following PEP 8 ✅ has proper concept illustrations and com

Samyak Jain 2 Jan 15, 2022
Glyph Metadata Palette

This plugin for Glyphs3 allows you to associate arbitrary structured metadata to each glyph in your font.

Simon Cozens 4 Jan 26, 2022
Driving lessons made simpler. Custom scheduling API built with Python.

NOTE This is a mirror of a GitLab repository. Dryvo Dryvo is a unique solution for the driving lessons industry. Our aim is to save the teacher’s time

Adam Goldschmidt 595 Dec 05, 2022
A program that analyzes data from inertia measurement units installeed in aircraft and generates g-exceedance curves

A program that analyzes data from inertia measurement units installeed in aircraft and generates g-exceedance curves

Pooya 1 Nov 23, 2021
A python program, imitating functionalities of a banking system

A python program, imitating functionalities of a banking system, in order for users to perform certain operations in a bank.

Moyosore Weke 1 Nov 26, 2021
Gives criticality score for an open source project

Open Source Project Criticality Score (Beta) This project is maintained by members of the Securing Critical Projects WG. Goals Generate a criticality

Open Source Security Foundation (OpenSSF) 1.1k Dec 23, 2022
Pacman - A suite of tools for manipulating debian packages

Overview Repository is a suite of tools for manipulating debian packages. At a h

Pardis Pashakhanloo 1 Feb 24, 2022