Font renaming script for otf and ttf fonts
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
CHANGELOG.md
LICENSE
README.md
fontname.py

README.md

fontname.py

About

fontname.py is a .ttf and .otf font renaming script that is developed in Python. It supports font renaming with current versions of the Python 2 and Python 3 interpreters.

Dependency

Install with:

pip install fonttools

Usage

The script usage is as follows:

$ python fontname.py [NEW FONT FAMILY NAME] [FONT PATH 1] <FONT PATH ...>

This script updates the OpenType name table records nameID 1, 4, and 6 with appropriately formatted font names using the font variant already defined in the font file and the new font family name defined by the user as the first command line argument. You can include any number of subsequent font file paths on the command line. The variant type will be detected in the OpenType tables of the font(s) on the filepaths that are passed as arguments on the command line and will be used to create new name strings in the OpenType tables.

Note: this re-writes the name tables in the fonts passed as arguments on the command line (i.e. writes files in place) so make copies first if you intend to maintain the fonts with the former naming for any reason (though you can simply re-write with the previous name if you forget...).

Examples

$ python fontname.py "Hack DEV" Hack-Regular.ttf

fscw-hack

$ python fontname.py "Source Code Pro DEV" SourceCodePro-Regular.otf

fscw-scp

$ python fontname.py "DejaVu Sans Mono DEV" DejaVuSansMono-Bold.ttf

fscw-djv

These should all be detected as "different" fonts so that you can install them side-by-side with the pre-modified versions.