Fontist

How to create a new formula?

Formula’s purpose is to let fontist to determine where to download fonts.

There is a command which can generate a formula by an archive’s link:

fontist create-formula https://quoteunquoteapps.com/courierprime/downloads/courier-prime.zip

A result of its execution would be a yaml file. It can be changed with a text editor.

You may need to change it manually when:

The formula can be proposed to be merged to the main repository, or added to a private repository.

How to create a private repository

Fontist supports additional formulas repositories, called "private".

To create a new private repository, setup a new git repository, and place formulas there:

mkdir acme
cd acme
git init
cp ../courier_prime.yml . # from example above
git add courier_prime.yml
git commit -m "Add formula for Courier Prime"
git remote add origin git@example.com:acme/formulas.git # use your git hosting
git push origin main -u

How to add a private repository to Fontist

In order to find the private repository, fontist should be called with its URL or path:

fontist repo setup NAME URL

E.g.

fontist repo setup acme https://example.com/acme/formulas.git
# or
fontist repo setup acme git@example.com:acme/formulas.git

Then fonts from this repo can be installed:

fontist install "courier prime"
Note
A repository can be either an HTTPS or SSH Git repo. In case of SSH, a corresponding SSH key should be setup with ssh-agent in order to access this private repository.

How to update a private repository

If the private Fontist formula repository is updated, you can fetch the updates with the repo update command:

fontist repo update acme

If there is a need to avoid using private formulas, the repo can be removed with:

fontist repo remove acme

Authentication for private formulas or private formula repositories

Authorization of private archives in private formulas can be implemented with headers.

Here is an example which works with Github releases:

resources:
  fonts.zip:
    urls:
    - url: https://example.com/repos/acme/formulas/releases/assets/38777461
      headers:
        Accept: application/octet-stream
        Authorization: token ghp_1234567890abcdefghi

A token can be obtained on the GitHub Settings > Tokens page. This token should have at least the repo scope for access to these assets.