Skip to main content

PyFontConverter

PyFontConverter is a command line tool to convert font formats.

Installation

pip install PyFontConverter

To install in editable mode:

git clone https://github.com/ftCLI/PyFontConverter.git
cd font-converter
pip install -e .

Usage

font-converter COMMAND [ARGS]

Arguments

INPUT_PATH

All font-converter subcommands process files in the given path. The INPUT_PATH argument can be a single font file or a folder containing one or more fonts. In case a directory is passed as INPUT_PATH, all fonts stored in it will be processed.

Common options

The -out, -output-dir, --recalc-timestamp and --no-overwrite options can be used in all subcommands, unless otherwise specified.

-out, --output-dir

The directory where the converted files are to be saved. If output_dir is not specified, files are saved to the source folder. If output_dir doesn't exist, it will be automatically created.

--recalc-timestamp

By default, original head.modified value is kept when a font is saved. Use this switch to set head.modified timestamp to current time.

--no-overwrite

By default, converted files are overwritten. Use this switch to save them to a new file (numbers are appended at the end of file name, so that Times-Bold.otf becomes TimesBold#1.otf).

Commands

font-converter ft2wf

Converts SFNT fonts (TTF or OTF) to web fonts (WOFF and WOFF2).

Usage:

font-converter ft2wf [OPTIONS] INPUT_PATH

Options:

  -f, --flavor [woff|woff2]     By default, the script converts SFNT fonts
                                (TrueType or OpenType) both to woff and woff2
                                flavored web fonts. Use this option to create
                                only woff (--flavor woff) or woff2 (--flavor
                                woff2) files.
  -out, --output-dir DIRECTORY  Specify the directory where output files are
                                to be saved. If output_dir doesn't exist, will
                                be created. If not specified, files are saved
                                to the same folder.
  --recalc-timestamp            Keep the original font 'modified' timestamp
                                (head.modified) or set it to current time. By
                                default, original timestamp is kept.
  --no-overwrite                Overwrite existing output files or save them
                                to a new file (numbers are appended at the end
                                of file name). By default, files are
                                overwritten.
  --help                        Show this message and exit.

font-converter otf2ttf

Converts fonts from CFF to TrueType format.

Usage:

font-converter otf2ttf [OPTIONS] INPUT_PATH

Options:

  -out, --output-dir DIRECTORY  Specify the directory where output files are
                                to be saved. If output_dir doesn't exist, will
                                be created. If not specified, files are saved
                                to the same folder.
  --recalc-timestamp            Keep the original font 'modified' timestamp
                                (head.modified) or set it to current time. By
                                default, original timestamp is kept.
  --no-overwrite                Overwrite existing output files or save them
                                to a new file (numbers are appended at the end
                                of file name). By default, files are
                                overwritten.
  --help                        Show this message and exit.

font-converter ttc2sfnt

Extracts each font from a TTC file, and saves it as a TTF or OTF file.

Usage

font-converter ttc2sfnt [OPTIONS] INPUT_PATH

Options:

  -out, --output-dir DIRECTORY  Specify the directory where output files are
                                to be saved. If output_dir doesn't exist, will
                                be created. If not specified, files are saved
                                to the same folder.
  --recalc-timestamp            Keep the original font 'modified' timestamp
                                (head.modified) or set it to current time. By
                                default, original timestamp is kept.
  --no-overwrite                Overwrite existing output files or save them
                                to a new file (numbers are appended at the end
                                of file name). By default, files are
                                overwritten.
  --help                        Show this message and exit.

font-converter ttf2otf

Converts fonts from TrueType to CFF format.

Usage:

font-converter ttf2otf [OPTIONS] INPUT_PATH

Options

  -t, --tolerance FLOAT RANGE   Conversion tolerance (0-5, default 1). Low
                                tolerance adds more points but keeps shapes.
                                High tolerance adds few points but may change
                                shape.  [0<=x<=5]
  --safe                        Sometimes Qu2CuPen may fail or produce
                                distorted outlines. Most of times, using '--
                                safe' will prevent errors by converting the
                                source TTF font to a temporary OTF built using
                                T2CharstringsPen, and then reconverting it to
                                a temporary TTF font. This last one will be
                                used for TTF to OTF conversion instead of the
                                source TTF file. This is slower and produces
                                slightly bigger files, but is safer.
  --keep-glyphs                 Doesn't remove 'NULL' and 'CR' glyphs from the
                                output font.
  --no-subr                     Turn off subroutinization of converted fonts.
  -out, --output-dir DIRECTORY  Specify the directory where output files are
                                to be saved. If output_dir doesn't exist, will
                                be created. If not specified, files are saved
                                to the same folder.
  --recalc-timestamp            Keep the original font 'modified' timestamp
                                (head.modified) or set it to current time. By
                                default, original timestamp is kept.
  --no-overwrite                Overwrite existing output files or save them
                                to a new file (numbers are appended at the end
                                of file name). By default, files are
                                overwritten.
  --help                        Show this message and exit.

font-converter var2static

Exports static instances from variable fonts.

Usage:

font-converter var2static [OPTIONS] INPUT_PATH

Options:

  -s, --select-instance         By default, the script exports all named
                                instances. Use this option to select custom
                                axis values for a single instance.
  --no-cleanup                  By default, STAT table is dropped and axis
                                nameIDs are deleted from name table. Use --no-
                                cleanup to keep STAT table and prevent axis
                                nameIDs to be deleted from name table.
  --update-name-table           Tries to update the instantiated font's `name`
                                table. Input font must have a STAT table with
                                Axis Value Tables.
  -out, --output-dir DIRECTORY  Specify the directory where output files are
                                to be saved. If output_dir doesn't exist, will
                                be created. If not specified, files are saved
                                to the same folder.
  --recalc-timestamp            Keep the original font 'modified' timestamp
                                (head.modified) or set it to current time. By
                                default, original timestamp is kept.
  --no-overwrite                Overwrite existing output files or save them
                                to a new file (numbers are appended at the end
                                of file name). By default, files are
                                overwritten.
  --help                        Show this message and exit.

font-converter wf2ft

Converts web fonts (WOFF and WOFF2) to SFNT fonts (TTF or OTF).

Usage:

font-converter wf2ft [OPTIONS] INPUT_PATH

Options:

  -f, --flavor [woff|woff2]     By default, the script converts both woff and
                                woff2 flavored web fonts to SFNT fonts
                                (TrueType or OpenType). Use this option to
                                convert only woff or woff2 flavored web fonts.
  -d, --delete-source-file      Deletes the source files after conversion.
  -out, --output-dir DIRECTORY  Specify the directory where output files are
                                to be saved. If output_dir doesn't exist, will
                                be created. If not specified, files are saved
                                to the same folder.
  --recalc-timestamp            Keep the original font 'modified' timestamp
                                (head.modified) or set it to current time. By
                                default, original timestamp is kept.
  --no-overwrite                Overwrite existing output files or save them
                                to a new file (numbers are appended at the end
                                of file name). By default, files are
                                overwritten.
  --help                        Show this message and exit.

Metadata

Release files for PyFontConverter 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyFontConverter 1.0.2
File Size Uploaded Provenance Actions
PyFontConverter-1.0.2.tar.gz 14.7 kB Without provenance Details for PyFontConverter-1.0.2.tar.gz

Release files / PyFontConverter-1.0.2.tar.gz

Download URL PyFontConverter-1.0.2.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6064addd53c9488bef74fc2cb28e57d5704f3593a5853dd6c09f9623bc5a9e32
BLAKE2b-256 checksum
How to use checksums
58a0dbc800b1d8771766532c0a40b02c039c0f6d0ae20f8cf492e74dd6048af3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for PyFontConverter 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page