ChristinWhite / ligaturizer

Programming Fonts with Ligatures added (& a script to add them to other fonts)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.
  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 or enable copying of individual character glyphs; 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).

Related Projects

For more awesome programming fonts with ligatures, check out:

  1. FiraCode
  2. Hasklig

About

Programming Fonts with Ligatures added (& a script to add them to other fonts)

License:GNU General Public License v3.0


Languages

Language:Python 97.7%Language:Makefile 2.3%