Skip to content

Font renaming script for otf and ttf fonts

License

Notifications You must be signed in to change notification settings

moyogo/fontname.py

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Font renaming script for otf and ttf fonts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%