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
Simple tooling for marking deprecated functions or classes and re-routing to the new successors' instance.

pyDeprecate Simple tooling for marking deprecated functions or classes and re-routing to the new successors' instance

Jirka Borovec 45 Nov 24, 2022
Backend Interview Challenge

Inspect HOA backend challenge This is a simple flask repository with some endpoints and requires a few more endpoints. It follows a simple MVP (model-

1 Jan 20, 2022
CountBoard 是一个基于Tkinter简单的,开源的桌面日程倒计时应用。

CountBoard 是一个基于Tkinter简单的,开源的桌面日程倒计时应用。 基本功能 置顶功能 是否使窗体一直保持在最上面。 简洁模式 简洁模式使窗体更加简洁。 此模式下不可调整大小,请提前在普通模式下调整大小。 设置功能 修改主窗体背景颜色,修改计时模式。 透明设置 调整窗体的透明度。 修改

gaoyongxian 130 Dec 01, 2022
My Dotfiles of Arco Linux

Arco-DotFiles My Dotfiles of Arco Linux Apps Used Htop LightDM lightdm-webkit2-greeter Alacritty Qtile Cava Spotify nitrogen neofetch Spicetify Thunar

$BlueDev5 6 Dec 11, 2022
Tool to audit and fix Python project requirements.

Requirement Auditor Utility to revise and updated python requirement files.

Luis Carlos Berrocal 1 Nov 07, 2021
A very small (15 lines of code) and beautiful fetch script (exclusively for Arch Linux).

minifetch A very small (15 lines of code) and beautiful fetch script (exclusively for Arch Linux). There are many fetch scripts out there but I wanted

16 Jul 11, 2022
A collection of repositories used to realise various end-to-end high-level synthesis (HLS) flows centering around the CIRCT project.

circt-hls What is this?: A collection of repositories used to realise various end-to-end high-level synthesis (HLS) flows centering around the CIRCT p

29 Dec 14, 2022
Wunderland desktop wallpaper and Microsoft Teams background.

Wunderland Professional Impress your colleagues, friends and family with this edition of the "Wunderland" wallpaper. With the nostalgic feel of the or

3 Dec 14, 2022
Add your recently blog and douban states in your GitHub Profile

Add your recently blog and douban states in your GitHub Profile

Bingjie Yan 4 Dec 12, 2022
Alternative StdLib for Nim for Python targets

Alternative StdLib for Nim for Python targets, hijacks Python StdLib for Nim

Juan Carlos 100 Jan 01, 2023
IDA Pro plugin that shows the comments in a database

ShowComments A Simple IDA Pro plugin that shows the comments in a database Installation Copy the file showcomments.py to the plugins folder under IDA

Fernando Mercês 32 Dec 10, 2022
A small project of two newbies, who wanted to learn something about Python language programming, via fun way.

HaveFun A small project of two newbies, who wanted to learn something about Python language programming, via fun way. What's this project about? Well.

Patryk Sobczak 2 Nov 24, 2021
Buildium-to-stessa - Automation to assist in converting Buildium transactions into Stessa format

Buildium Transactions - Stessa Transactions There is currently no third-party i

Austin Comstock 4 Apr 17, 2022
Bible-App : Simple Tool To Show Bible Books

Bible App Simple Tool To Show Bible Books Socials: Language:

ميخائيل 5 Jan 18, 2022
Medical appointments No-Show classifier

Medical Appointments No-shows Why do 20% of patients miss their scheduled appointments? A person makes a doctor appointment, receives all the instruct

4 Apr 20, 2022
Python library for Minitel communication through serial port

Python library for Minitel communication through serial port

Noël 3 Aug 14, 2022
Easy, clean, reliable Python 2/3 compatibility

Overview: Easy, clean, reliable Python 2/3 compatibility python-future is the missing compatibility layer between Python 2 and Python 3. It allows you

Python Charmers 1.2k Jan 08, 2023
LOC-FLOW is an “hands-free” earthquake location workflow to process continuous seismic records

LOC-FLOW is an “hands-free” earthquake location workflow to process continuous seismic records: from raw waveforms to well located earthquakes with magnitude calculations. The package assembles sever

Miao Zhang 71 Jan 09, 2023
This repository contains various tools useful for offensive operations (reversing, etc) regarding the PE (Portable Executable) format

PE-Tools This repository contains various tools useful for offensive operations (reversing, etc) regarding the PE (Portable Executable) format Install

stark0de 4 Oct 13, 2022
The refactoring tutorial I wrote for PyConDE 2022. You can also work through the exercises on your own.

Refactoring 101 planet images by Justin Nichol on opengameart.org CC-BY 3.0 Goal of this Tutorial In this tutorial, you will refactor a space travel t

Kristian Rother 9 Jun 10, 2022