fira | ||
images | ||
input-fonts | ||
output-fonts | ||
.gitignore | ||
LICENSE | ||
ligatures.py | ||
ligaturize.py | ||
Makefile | ||
README.md |
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:
-
Programming fonts with ligatures added (in
output-fonts/
), including:- Anonymous Pro
- CamingoCode
- Cousine: Regular, Bold
- DejaVu Sans Mono
- Droid Sans Mono
- edlo
- Hack
- Inconsolata & Inconsolata-g
- IBM Plex Mono: Regular, Semibold
- Meslo (LGL, LGLDZ, LGM, LGMDZ, LGS, LGSDZ
- Oxygen Mono
- Roboto Mono
- SF Mono: Regular, Semibold
- Ubuntu Mono
-
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).
- Put the font(s) you want into
input-fonts/
. - 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. - Run
make
. - Retrieve the ligaturized fonts from
output-fonts/
. - The output fonts will be renamed with the prefix "Liga".
Manual
- Move/copy the font you want to ligaturize into
input-fonts/
(or somewhere else convenient). - 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. - 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).
Related Projects
For more awesome programming fonts with ligatures, check out: