Skip to content

Font renaming script for OpenType tables in CFF (.otf) and OT TrueType (.ttf) fonts

License

Notifications You must be signed in to change notification settings

matthewlindsey/fontname

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fontname

About

A Python utility that renames OpenType (.otf) and TrueType (.ttf) fonts using the fonttools library. This forked version of Chris Simpkins' fontname.py script has been packaged to allow simple installation as a global command line tool using pipx.

Font renaming script for OpenType tables in CFF (.otf) and OT TrueType (.ttf) fonts

Requirements

  • Python 3.6 or later

Dependencies

Usage

Use fontname to rename fonts as follows:

$ fontname family_name font_file...

The fontname command updates the name table records of .ttf and .otf files with appropriately formatted font names given the user-provided family_name and the style definition found within each font_file.

A few things to keep in mind:

  • You can provide multiple font_file arguments
  • Use quotes around family_name arguments that include spaces
  • This tool edits the font files in place, so make copies beforehand if you you would like to preserve the fonts with their former names. (You can always rewrite them with the previous name if you forget or change your mind.)

Details

To apply a new family name to a font file, fontname updates the following entries in its name table: Family Name (name ID 1). Full Name (name ID 4), PostScript name (id 6), Typographic Family (id 16). For OpenType fonts with Compact Font Format data, fonttools also updates the FontName, FullName, and FamilyName records in the CFF table.

Examples

$ fontname "Hack DEV" Hack-Regular.ttf

fscw-hack

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

fscw-scp

$ fontname "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.

Warnings

Many fonts have licences prohibiting modifications of any kind, including changes to font family names and other metadata. Please make sure to understand and respect the licenses of any fonts you wish to rename.

License

MIT License

About

Font renaming script for OpenType tables in CFF (.otf) and OT TrueType (.ttf) fonts

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 100.0%