Programming Fonts with Ligatures added (& a script to add them to other fonts)
Go to file
2018-01-27 14:26:01 -05:00
fira Infer ligature font weight from output name; update FiraCode fonts 2018-01-19 19:56:24 -05:00
images Updated README 2017-10-19 12:49:18 -07:00
input-fonts Add a Makefile and regenerate the output fonts using it. 2018-01-22 19:14:10 -05:00
output-fonts Work around Fontforge underline position bug. 2018-01-22 20:18:44 -05:00
.gitignore Initial commit 2017-08-07 22:21:10 -07:00
LICENSE Add License 2018-01-18 20:02:37 -08:00
ligatures.py Update ligatures list with all ligatures from FC 1.204 2018-01-19 20:15:04 -05:00
ligaturize.py Switch to argparse for argument handling 2018-01-27 14:26:01 -05:00
Makefile Suppress warnings about blank substitution table entries 2018-01-26 19:42:02 -05:00
README.md Switch to argparse for argument handling 2018-01-27 14:26:01 -05:00

Ligaturizer

Add ligatures to any coding font!

This script copies the ligatures (glyphs and rendering information) from Fira Code into any other TrueType or OpenType font. (Note that the ligatures are scale-corrected, but otherwise copied as is from Fira Code; it doesn't create new ligature graphics based on the font you're modifying.)

This repo contains 2 things:

  1. Programming fonts with ligatures added (in output-fonts/), including:

  2. A fontforge python script (ligaturize.py) that you can use to add the Fira Code ligatures to any other font you like.

Here's a couple examples of the fonts generated: SF Mono & Menlo with ligatures (note the != and ->):

Requirements

Using the Fonts: See the FiraCode README for a list of supported editors.

Script: This script requires FontForge python bindings. For Debian/Ubuntu they are available in python-fontforge package. For OpenSUSE and NixOS, they are included in the fontforge package. For macOS, they are available via brew (brew install fontforge).

Using the Script

Automatic

Use automatic mode to easily convert 1 or more font(s).

  1. Put the font(s) you want into input-fonts/.
  2. Edit ligatures.py to disable any ligatures you don't want, and/or enable any (non-ligature) characters you want from Fira Code in addition to the ligatures.
  3. Run make.
  4. Retrieve the ligaturized fonts from output-fonts/.
  5. The output fonts will be renamed with the prefix "Liga".

Manual

  1. Move/copy the font you want to ligaturize into input-fonts/ (or somewhere else convenient).
  2. Edit ligatures.py to disable any ligatures you don't want, and/or enable any (non-ligature) characters you want from Fira Code in addition to the ligatures.
  3. Run the script: $ fontforge -lang=py ligaturize.py <INPUT> <OUTPUT>, e.g. $ fontforge -lang=py ligaturize.py input-fonts/Cousine-Regular.ttf output-fonts/CousineLigaturized-Regular.ttf

The font family and weight for the output font (as recorded in the file) will be automatically set based on the name; if the output is CousineLigaturized-Regular.ttf, the font family will be CousineLigaturized and the font weight will be Regular. If no weight is specified, Regular is the default.

ligatures.py supports some additional command line options to (e.g.) change which font ligatures are copied from; run fontforge -lang=py ligaturize.py --help to list them.

Misc.

Credit

This script was originally written by IlyaSkriblovsky for adding ligatures to DejaVuSans Mono (dv-code-font). I made a few changes to generalize the script so that it works for any font, so that I could add ligatures to my favorite fonts. ToxicFrog has made a large number of contributions.

Contributions

Contributions always welcome! Please submit a Pull Request, or create an Issue if you have an idea for a feature/enhancement (or bug).

For more awesome programming fonts with ligatures, check out:

  1. FiraCode
  2. Hasklig