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:

    cdrozak@DESKTOP-FQHI27R:/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:

    cdrozak@DESKTOP-FQHI27R:/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
Gba-free-fonts - Free font resources for GBA game development

gba-free-fonts Free font resources for GBA game development This repo contains m

null 28 Dec 30, 2022
This is a library which aiming to save all my code about cpp. It will help me to code conveniently.

This is a library which aiming to save all my code about cpp. It will help me to code conveniently.

Paul Leo 21 Dec 6, 2021
AIST++ API This repo contains starter code for using the AIST++ dataset.

AIST++ API This repo contains starter code for using the AIST++ dataset. To download the dataset or explore details of this dataset, please go to our

Google 260 Dec 30, 2022
Code for the manim-generated scenes used in 3blue1brown videos

This project contains the code used to generate the explanatory math videos found on 3Blue1Brown. This almost entirely consists of scenes generated us

Grant Sanderson 4.1k Jan 2, 2023
Code and yara rules to detect and analyze Cobalt Strike

Cobalt Strike Resources This repository contains: analyze.py: a script to analyze a Cobalt Strike beacon (python analyze.py BEACON) extract.py; extrac

Tek 224 Jan 4, 2023
:art: Diagram as Code for prototyping cloud system architectures

Diagrams Diagram as Code. Diagrams lets you draw the cloud system architecture in Python code. It was born for prototyping a new system architecture d

MinJae Kwon 27.5k Jan 4, 2023
💻 Algo-Phantoms-Backend is an Application that provides pathways and quizzes along with a code editor to help you towards your DSA journey.📰🔥 This repository contains the REST APIs of the application.✨

Algo-Phantom-Backend ?? Algo-Phantoms-Backend is an Application that provides pathways and quizzes along with a code editor to help you towards your D

Algo Phantoms 44 Nov 15, 2022
Source code for Learn Programming: Python

This repository contains the source code of the game engine behind Learn Programming: Python. The two key files are game.py (the main source of the ga

Niema Moshiri 25 Apr 24, 2022
samples of neat code

NEAT-samples Some samples of code and config files for use with the NEAT-Python package These samples are largely copy and pasted, so if you

Harrison 50 Sep 28, 2022
Viewflow is an Airflow-based framework that allows data scientists to create data models without writing Airflow code.

Viewflow Viewflow is a framework built on the top of Airflow that enables data scientists to create materialized views. It allows data scientists to f

DataCamp 114 Oct 12, 2022
This is the code of Python enthusiasts collection and written.

I am Python's enthusiast, like to collect Python's programs and code.

cnzb 35 Apr 18, 2022
3D Printed Flip Clock Design and Code

Smart Flip Clock 3D printed smart clock that puts a new twist on old technology. Making The Smart Flip Clock The first thing that must be done for thi

Thomas 105 Oct 17, 2022
laTEX is awesome but we are lazy -> groff with markdown syntax and inline code execution

pyGroff A wrapper for groff using python to have a nicer syntax for groff documents DOCUMENTATION Very similar to markdown. So if you know what that i

Subhaditya Mukherjee 27 Jul 23, 2022
A toolkit for developing and deploying serverless Python code in AWS Lambda.

Python-lambda is a toolset for developing and deploying serverless Python code in AWS Lambda. A call for contributors With python-lambda and pytube bo

Nick Ficano 1.4k Jan 3, 2023
Simple python code for compile brainfuck program.

py-brainf*ck Just a basic compiled that compiles your brainf*ck codes and gives you informations about memory, used cells, dumped version, logs etc...

null 4 Jun 13, 2021
The code for 2021 MGTV AI Challenge Anti Stealing Link, and the online result ranks 10th.

赛题介绍 芒果TV-第二届“马栏山杯”国际音视频算法大赛-防盗链 随着业务的发展,芒果的视频内容也深受网友的喜欢,不少视频网站和应用开始盗播芒果的视频内容,盗链网站不经过芒果TV的前端系统,跳过广告播放,且消耗大量的服务器、带宽资源,直接给公司带来了巨大的经济损失,因此防盗链在日常运营中显得尤为重要

tongji40 16 Jun 17, 2022
sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character.

ꦱꦮ sawa (ꦱꦮ) is an open source programming language, an interpreter to be precise, where you can write python code using javanese character. sawa iku

Rony Lantip 307 Jan 7, 2023
python3 scrip for case conversion of source code files writen in fixed form fortran

convert_FORTRAN_case python3 scrip for case conversion of source code files writen in fixed form fortran python3 scrip for case conversion of source c

null 7 Sep 20, 2022