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
Location of public benchmarking; primarily final results

CSL_public_benchmark This repo is intended to provide a periodically-updated, public view into genome sequencing benchmarks managed by HudsonAlpha's C

HudsonAlpha Institute for Biotechnology 15 Jun 13, 2022
FCurve-Cleaner: Tries to clean your dense mocap graphs like an animator would

Tries to clean your dense mocap graphs like an animator would! So it will produce a usable artist friendly result while maintaining the original graph.

wiSHFul97 5 Aug 17, 2022
An OrpheusDL Tidal module

OrpheusDL - Tidal A Tidal module for the OrpheusDL modular archival music program Report Bug · Request Feature Table of content About OrpheusDL - Tida

Daniel 54 Dec 29, 2022
Мой первый калькулятор!!!!!!

my_first_calculator Первый калькулятор созданный мною на питоне Версия калькулятора: 0.0.4 Как скачать? TERMUX Для скрипта нужен питон, скачиваем pkg

Lesha Russkiyov 2 Dec 29, 2021
DC619/DC858 Mainframe Environment/Lab

DC619 Training LPAR The file DC619 - Mainframe Overflows Hands On.pdf contains the labs and walks through how to perform them. Use docker You can use

Soldier of FORTRAN 9 Jun 27, 2022
Problem statements on System Design and Software Architecture as part of Arpit's System Design Masterclass

Problem statements on System Design and Software Architecture as part of Arpit's System Design Masterclass

Relog 1.1k Jan 04, 2023
Batch Python Program Verify

Batch Python Program Verify About As a TA(teaching assistant) of Programming Class, it is very annoying to test students' homework assignments one by

Han-Wei Li 7 Dec 20, 2022
Keyboard Layout Change - Extension for Ulauncher

Keyboard Layout Change - Extension for Ulauncher

Marco Borchi 4 Aug 26, 2022
A guy with a lot of useful things to do when doing AtCoder in Python

atcoder_python_env Python で AtCoder をやるときに便利な諸々を用意したやつ コンテスト用フォルダの作成 セットアップ 自動テス

2 Dec 28, 2021
Pylexa - Artificial Assistant made with Python

Pylexa - Artificial Assistant made with Python Alexa is a famous artificial assistant used massively across the world. It is a substitute of Alexa whi

\_PROTIK_/ 4 Nov 03, 2021
Simply create JIRA releases based on your github releases

Simply create JIRA releases based on your github releases

8 Jun 17, 2022
The Official Jaseci Code Repository

Jaseci Release Notes Version 1.2.2 Updates Added new built-ins for nodes and edges (context, info, and details) Fixed dot output Added reset command t

136 Dec 20, 2022
Cylinder volume calculator features the calculations of the volume of a Right /oblique full cylinder

Cylinder-Volume-Calculator Cylinder volume calculator features the calculations of the volume of a Right /oblique full cylinder. Size : 10.5 mb compat

Abhijeet 4 Nov 07, 2022
Wrapper around anjlab's Android In-app Billing Version 3 to be used in Kivy apps

IABwrapper Wrapper around anjlab's Android In-app Billing Version 3 to be used in Kivy apps Install pip install iabwrapper Important ( Add these into

Shashi Ranjan 8 May 23, 2022
Rufus port to linux, writed on Python3

Rufus-for-Linux Rufus port to linux, writed on Python3 Программа будет иметь тот же интерфейс что и оригинал, и тот же функционал. Программа создается

6 Jan 07, 2022
Convert Beat Saber maps to Tesla light shows!

Tesla x Beat Saber - Light Show Converter Convert Beat Saber maps to Tesla light shows! This project requires FFMPEG and all packages from requirement

HLVM 20 Dec 21, 2022
Howell County, Missouri, COVID-19 data and (unofficial) estimates

COVID-19 in Howell County, Missouri This repository contains the daily data files used to generate my COVID-19 dashboard for Howell County, Missouri,

Jonathan Thornton 0 Jun 18, 2022
A pomodoro app written in Python

Pomodoro It's a pomodoro app written in Python. You can minimize it while you're working if you want to, it'll pop up on your screen when the timer is

Yiğit 1 Dec 20, 2021
Open source home automation that puts local control and privacy first

Home Assistant Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiast

Home Assistant 57k Jan 02, 2023
This is an implementation of PEP 557, Data Classes.

This is an implementation of PEP 557, Data Classes. It is a backport for Python 3.6. Because dataclasses will be included in Python 3.7, any discussio

Eric V. Smith 561 Dec 06, 2022