Programming Fonts with Ligatures added (& a script to add them to other fonts)
Go to file
Ben Kelly 01b7c2bb01 Completely rework build process, and rename files for license compliance
This addresses #25 and (partially) #42; fonts that we can't make derivative
works of are no longer checked in, and fonts that need to be renamed for
license compliance have been.

The build process is also now a bit more robust.
2018-08-31 14:47:53 -04:00
fira@30862e05b0 Move fira to submodule 2018-08-31 10:27:50 -04:00
images Updated README 2017-10-19 12:49:18 -07:00
input-fonts Completely rework build process, and rename files for license compliance 2018-08-31 14:47:53 -04:00
output-fonts Completely rework build process, and rename files for license compliance 2018-08-31 14:47:53 -04:00
.gitignore Initial commit 2017-08-07 22:21:10 -07:00
.gitmodules Move fira to submodule 2018-08-31 10:27:50 -04:00
build.py Completely rework build process, and rename files for license compliance 2018-08-31 14:47:53 -04:00
LICENSE Add License 2018-01-18 20:02:37 -08:00
ligatures.py Lookup letter glyphs by codepoint rather than name 2018-03-06 21:14:35 -05:00
ligaturize.py Completely rework build process, and rename files for license compliance 2018-08-31 14:47:53 -04:00
Makefile Completely rework build process, and rename files for license compliance 2018-08-31 14:47:53 -04:00
README.md Completely rework build process, and rename files for license compliance 2018-08-31 14:47:53 -04:00
stat.py Add 'stat' tool for reading font information 2018-04-22 20:09:39 -04: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. Edit build.py to add your new font(s) to the prefixed_fonts list. It supports globbing, so if (e.g.) you want to ligaturize all the different weights of FooFont you can add 'FooFont*' to the list.
  4. Run make.
  5. Retrieve the ligaturized fonts from output-fonts/.
  6. 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 -script ligaturize.py path/to/input/font.ttf
        --output-dir=path/to/output/dir/ \
        --output-name='Name of Ligaturized Font'
    

    e.g.

    $ fontforge -lang py -script ligaturize.py fonts/Cousine-Regular.ttf
        --output-dir='fonts/' \
        --output-name='Ligaturized Cousine'
    

    Which will produce `fonts/LigaturizedCousine-Regular.ttf`.

The font weight will be inherited from the original file; the font name will be replaced with whatever you specified in `--output-name`. You can also use `--prefix` instead, in which case the original name will be preserved and whatever you put in `--prefix` will be prepended to it.

`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](https://github.com/IlyaSkriblovsky) for adding ligatures to DejaVuSans Mono ([dv-code-font](https://github.com/IlyaSkriblovsky/dv-code-font)). [Navid Rojiani](https://github.com/rojiani) made a few changes to generalize the script so that it works for any font. [ToxicFrog](https://github.com/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](https://github.com/tonsky/FiraCode)
2. [Hasklig](https://github.com/i-tu/Hasklig)