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
🥦 Send and receive nano with 2 simple functions

easy_nano Send and receive nano (without having to understand the nano protocol).

1 Feb 14, 2022
The Python Fuzzer that the world deserves 🐍

pip3 install frelatage Current release : 0.0.2 The Python Fuzzer that the world deserves Installation | How it works | Features | Use Frelatage | Conf

Rog3r 219 Dec 21, 2022
Python with braces. Because Python is awesome, but whitespace is awful.

Bython Python with braces. Because Python is awesome, but whitespace is awful. Bython is a Python preprosessor which translates curly brackets into in

1 Nov 04, 2021
Provide Prometheus url_sd compatible API Endpoint with data from Netbox

netbox-plugin-prometheus-sd Provide Prometheus http_sd compatible API Endpoint with data from Netbox. HTTP SD is a new feature in Prometheus and not a

Felix Peters 66 Dec 19, 2022
Ronin - Create Fud Meterpreter Payload To Hack Windows 11

Ronin - Create Fud Meterpreter Payload To Hack Windows 11

Dj4w3d H4mm4di 6 May 09, 2022
Dot Browser is a privacy-conscious web browser with smarts built-in for protection against trackers and advertisments online.

🌍 Take back your privacy with Dot Browser, the privacy-conscious web browser that protects you from being tracked and monitored online.

Dot HQ 1k Jan 07, 2023
Strawberry Benchmark With Python

Strawberry benchmarks these benchmarks have been made to compare the performance of dataloaders and joined database queries. How to use You can run th

Doctor 4 Feb 23, 2022
【AI创造营】参赛作品

-AI-emmmm 【AI创造营】参赛作品 鬼畜小视频 AiStuido地址:https://aistudio.baidu.com/aistudio/projectdetail/1647685 BiliBili视频地址:https://www.bilibili.com/video/BV1Zv411b

107 Nov 09, 2022
System Information Utility With Python

System-Information-Utility This is a simple utility, for the terminal, which allows you to find out information about your PC. It's very easy to run t

2 Apr 15, 2022
A simple and convenient build-and-run system for C and C++.

smake Smake is a simple and convenient build-and-run system for C and C++ projects. Why make another build system? CMake and GNU Make are great build

Venkataram Edavamadathil Sivaram 18 Nov 13, 2022
Hopefully the the next-generation backend server of bgm.tv

Hopefully the the next-generation backend server of bgm.tv

Bangumi 475 Jan 01, 2023
LinuxHelper - A collection of utilities for non-technical Linux users accessible via a GUI

Linux Helper A collection of utilities for non-technical Linux users accessible via a GUI This app is still in very early development, expect bugs and

Seth 7 Oct 03, 2022
Pyjiting is a experimental Python-JIT compiler, which is the product of my undergraduate thesis

Pyjiting is a experimental Python-JIT compiler, which is the product of my undergraduate thesis. The goal is to implement a light-weight miniature general-purpose Python JIT compiler.

Lance.Moe 10 Apr 17, 2022
This application is made solely for entertainment purposes

Timepass This application is made solely for entertainment purposes helps you find things to do when you're bored ! tells jokes guaranteed to bring on

Omkar Pramod Hankare 2 Nov 24, 2021
A simple armature retargeting tool for Blender

Simple-Retarget-Tool-Blender A simple armature retargeting tool for Blender Update V2: Set Rest Pose to easily apply rest pose. Preset Import/Export.

Fahad Hasan Pathik 74 Jan 04, 2023
An html wrapper for python

MessySoup What is it? MessySoup is a python wrapper for html elements. While still a ways away, the main goal is to be able to build a wesbite straigh

4 Jan 05, 2022
Framework To Ease Operating with Quantum Computers

QType Framework To Ease Operating with Quantum Computers Concept # define an array of 15 cubits:

Antonio Párraga Navarro 2 Jun 06, 2022
🛠️ Plugin to integrate Chuy with Poetry

Archived This is bundled with Chuy since v1.3.0. Poetry Chuy Plugin This plugin integrates Chuy with Poetry. Note: This only works in Poetry 1.2.0 or

Eliaz Bobadilla 4 Sep 24, 2021
Rufus port to linux, writed on Python3

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

6 Jan 07, 2022
Inspect the resources of your android projects and understand which ones are not being used and could potentially be removed.

Android Resources Checker What This program will inspect the resources of your app and help you understand which ones are not being used and could pot

Fábio Carballo 39 Feb 08, 2022