A command-line tool to download, manage and convert fonts
fonty is a command line interface that helps you simplify your font management workflow by allowing you to install and uninstall fonts like a package manager (think npm, apt-get, chocolatey). It can also help you create webfonts and generate @font-face declarations so that you can focus on building great websites.
Table of Contents
- Basic Usage
- Font Sources
Prerequisites: Please make sure you have at least Python 3 installed
> pip install fonty
fonty is only available for macOS and Windows for now. Linux support is planned.
2 Basic Usage
Append any command with
--help for a detailed help text of what you can do.
> fonty [command] --help
2.1 Installing and uninstalling fonts
2.1.1 Installing fonts
Downloading and installing a font from subscribed sources:
> fonty install Lato
Downloading a font into a directory:
> fonty install Lato -o "~/Desktop/Lato"
Download only the bold and bold italic variants of a font:
> fonty install Lato -v 700,700i
2.1.2 Uninstalling fonts
Uninstalling a font family from your computer:
> fonty uninstall Lato
Uninstalling only a specific variant:
# This only removes the 900i (Black Italic) variant of the font > fonty uninstall Lato -v 900i
2.2 Listing installed fonts
List all installed fonts
> fonty list
List further details about a specific installed font
> fonty list Lato
2.3 Generating webfonts
fonty can help you convert fonts to
woff2 formats, which is supported by all major browsers (IE9 and above) as well as generate their
Convert all *.ttf fonts in this directory to webfonts:
> fonty webfont *.ttf
Generate webfonts into a specific directory:
> fonty webfont *.ttf -o ./webfonts
Download a font from your subscribed sources and convert:
> fonty webfont --download Lato
Convert an existing installed font on your computer:
> fonty webfont --installed Lato
2.4 Managing font sources
fonty searches and downloads fonts from your list of subscribed sources. Upon installation, fonty automatically subscribes to a few default sources. Here's how you can manage your subscriptions:
Adding a new font source:
> fonty source add http://url/to/source.json
Removing a font source:
# Deleting by URL > fonty source remove http://url/to/source.json # Deleting by ID > fonty source remove e0f9cbd9977479825e1cd38aafb1660d
Show list of subscribed sources:
> fonty source list
> fonty source update
> fonty install <FONT NAME> [OPTIONS] # Example: `fonty install Lato` > fonty install <FONT URL> [OPTIONS] # Example: `fonty install http://url/to/Lato.ttf` > fonty install --files <FONT FILES> [OPTIONS] # Example: `fonty install --files *.ttf`
Installs a font into the computer or into a directory.
In it's default behaviour, fonty searches through your subscribed sources to download and install the specified font automatically. Alternatively, it can also support downloading
.otf files directly, or if a
--files flag is passed, fonty can help you install local font files on your computer.
- A comma separated list of variants with no spaces in between.
- Output fonts into this directory. If supplied, the fonts won't be installed into the system.
- If provided, read arguments as a list of font files to be installed. Files can be a glob pattern.
> fonty uninstall <FONT NAME> [OPTIONS]
Uninstalls a font from this computer.
This command uninstalls the specified font from the computer and deletes them into the Trash or Recycle Bin.
- A list of comma separated values of font variants with no spaces in between.
> fonty list [OPTIONS] > fonty list <FONT NAME> [OPTIONS]
Show a list of installed fonts.
This command shows a list of all installed fonts in this computer, scanned through the user's font directory.
If a specific font name is specified, then this command prints a list of all the font files of that particular family.
- If provided, rebuild the font manifest file.
> fonty webfont <FONT FILES> [OPTIONS] > fonty webfont --download <FONT NAME> [OPTIONS] > fonty webfont --installed <FONT NAME> [OPTIONS]
Convert fonts to webfonts and generate @font-face declarations.
This command convert fonts to
.woff2 formats, as well as generate their @font-face CSS declaration into a file named
fonty's default behaviour is to convert a list of font files that you have provided. You can specify glob patterns for your file paths. Alternatively, it can also download fonts using the
--download flag, or use an existing installed font on your computer using the
- If provided, download font from subscribed sources and convert.
- If provided, convert an existing font installed on the system.
- Output webfonts into a specific directory.
> fonty source add <SOURCE URL>
Adds a new font source.
This command allows you to add and subscribe to a new font source. This allows you to have instant access to all of the source's fonts through the
fonty install command.
> fonty source remove <SOURCE ID or SOURCE URL>
Removes a subscribed font source.
> fonty source list
Print a list of subscribed font sources.
This command shows a list of all subscribed sources, along with their IDs, update status, and number of available fonts.
> fonty source update [OPTIONS]
Check all subscribed sources for available updates.
When font sources are subscribed to, a local copy of the source is downloaded into your computer. Running this command updates your local copy with the latest one.
- If provided, force all sources to be redownloaded and rebuild the search index.
4 Font Sources
fonty relies on font sources to resolve, download and install fonts. A font source is simply a JSON file containing an index of its fonts, and where to download them.
With fonty, you can subscribe to multiple font sources at the same time to have instant access to a wide variety of fonts through the
fonty install command.
4.1 Default sources
Right out of the box, fonty is automatically subscribed to a few default font sources so you can enjoy the benefits of using fonty rightaway. These default sources are:
fonty's Google Fonts Repository
fonty's Open Source Fonts Repository
- A self-maintained list of open source fonts across the web.
- URL: https://sources.fonty.io/fontyfonts
You can unsubscribe and subscribe from these sources at anytime. See the
fonty source command.
4.2 Hosting your own
You may wish to host your own repository for your personal usage, or perhaps you might want to make a set of fonts available for your entire team. A repository of fonts is a powerful concept that allows people to share and use fonts effortlessly.
While fonty is still in alpha, the schema and specifications for font sources is still largely a work in progress. As such until fonty is fully released, it is not encouraged for you to host your own font sources yet as the schema might go through a large amount of changes before it is finalised.
- Implement command to disable/enable fonts
- Finalise fonty sources schema and specifications
- Add support for installation via
fonty is released under the Apache License, Version 2.0.
Copyright © 2018 [James] Ooi Weng Teik.