• Stars
    star
    304
  • Rank 136,430 (Top 3 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

OTFeatureFreezer GUI app and pyftfeatfreeze commandline tool in Python to permanently "apply" OpenType features to fonts, by remapping their Unicode assignments

OpenType Feature Freezer

With OpenType Feature Freezer, you can “freeze” some OpenType features into a font.

These features are then “on by default”, so characters previously accessible through OpenType features only (such as smallcaps, oldstyle numerals or localized forms) will now be accessible even in apps that don’t support OpenType features, such as LibreOffice, OpenOffice, or in apps that don’t support a particular feature, such as Microsoft Office in case of smallcaps.

Note: This tool actually remaps the cmap table of the font by applying the specified GSUB features. It will not work for substitutions where neither glyph has any cmap entries. Only single and alternate substitutions are supported.

This tool comes in two versions: OTFeatureFreezer: a simple GUI (graphical) app for macOS and Windows that you can download and run without any special perparations, and pyftfeatfreeze: a CLI (command-line) app that required Python 3.6 or newer to be installed on your computer.

Current version: 1.32

Installation

Install the OTFeatureFreezer GUI app for macOS

Download DMG for macOS

  1. On macOS, click the Download link above.
  2. Ctrl+click the downloaded DMG, choose Open, then Open again.
  3. Drag the OTFeatureFreezer.app icon to your /Applications folder.
  4. When you run the app for the first time, Ctrl+click the OTFeatureFreezer.app, choose Open, then click Open.
  5. Later, you can just double-click the icon to run the app. If the app does not run, double-click again.
  6. See the Documentation for info about how to use the GUI app. The GUI corresponds to the command-line options.

Install the OTFeatureFreezer GUI app for Windows (64-bit)

Download ZIP for Windows

  1. You need a 64-bit version of Windows, 7 or newer. 32-bit Windows is not supported.
  2. Click the Download link above.
  3. Unzip the downloaded ZIP.
  4. Double-click the setup_featfreeze.exe icon to install the app.
  5. Run OTFeatureFreezer from your Start menu.
  6. See the Documentation for info about how to use the GUI app. The GUI corresponds to the command-line options.

Install the pyftfeatfreeze CLI app

This tool requires Python 3.6 or above to be installed first. Get it from https://www.python.org or your package manager.

Recommended

We recommend using pipx to install Python command line tools. Pipx tucks them away neatly on your computer and gives you an easy way to add, update and remove Python tools on all platforms, without leaving a mess in your Python installation.

pipx install opentype-feature-freezer

Other methods

Install it with pip, as any other Python package.

# This is best done inside a virtual environment, so you don't pollute
# your Python installation and need no special privileges to install anything.

pip install --upgrade opentype-feature-freezer

If this does not work, try:

python3 -m pip install --user --upgrade opentype-feature-freezer

Development version

pip install --upgrade git+https://github.com/twardoch/fonttools-opentype-feature-freezer

If this does not work, use:

python3 -m pip install --user --upgrade git+https://github.com/twardoch/fonttools-opentype-feature-freezer
  • You may need to do pip install --upgrade configparser before installing

Documentation

Examples

Let’s say you have the font CharisSIL-R.ttf (with the menu name “Charis SIL”), and this font includes true smallcaps accessible via the OpenType Layout features c2sc (for uppercase) and smcp (for lowercase). Let’s say that you’d like to make a second font where the true smallcaps are available by default. Just run:

pyftfeatfreeze -f 'c2sc,smcp' -S -U SC -R 'Charis SIL/Charix,CharisSIL/Charix' CharisSIL-R.ttf CharixSC-R.ttf

You’ll get a new font CharisSIL-R.ttf (with the menu name “Charix SC”). This font will have smallcaps instead of the lowercase and uppercase letters, available in all apps.

Since the “Charis SIL” font is licensed under the OFL, and uses the Reserved Font Names “Charis” and “SIL”, I’ve specified the -R option to replace the name strings Charis SIL and CharisSIL with Charix. This way, the modified font is compliant with the OFL and I can distribute it.

The following example remaps the font so that the Bulgarian localized forms are available by default in all apps (the suffix “BG” will be added to the menu name):

pyftfeatfreeze -f 'locl' -s 'cyrl' -l 'BGR ' -S -U BG SomeFont.ttf SomeFontBG.ttf

Note: To remap features from multiple scripts or languagesystems, run the tool multiple times (taking the previous run’s output as input). Use the -S option only on the final run.

The following replaces the string Lato by Otal in all internal font names (in the name and CFF tables), without doing any “feature freezing”. This can be used to quickly change some internal font names:

pyftfeatfreeze -R 'Lato/Otal' Lato-Regular.ttf Otal-Regular.ttf

Command-line syntax

usage: pyftfeatfreeze [-h] [-f FEATURES] [-s SCRIPT] [-l LANG] [-z] [-S]
                      [-U USESUFFIX] [-R REPLACENAMES] [-i] [-r] [-n] [-v]
                      [-V]
                      inpath [outpath]

With pyftfeatfreeze you can "freeze" some OpenType features into a font. These
features are then "on by default", even in apps that don't support OpenType
features. Internally, the tool remaps the "cmap" table of the font by applying
the specified GSUB features. Only single and alternate substitutions are
supported.

positional arguments:
  inpath                input .otf or .ttf font file
  outpath               output .otf or .ttf font file (optional)

optional arguments:
  -h, --help            show this help message and exit

options to control feature freezing:
  -f FEATURES, --features FEATURES
                        comma-separated list of OpenType feature tags, e.g.
                        'smcp,c2sc,onum'
  -s SCRIPT, --script SCRIPT
                        OpenType script tag, e.g. 'cyrl' (default: 'latn')
  -l LANG, --lang LANG  OpenType language tag, e.g. 'SRB ' (optional)
  -z, --zapnames        zap glyphnames from the font ('post' table version 3,
                        .ttf only)

options to control font renaming:
  -S, --suffix          add a suffix to the font family name (by default, the
                        suffix will be constructed from the OpenType feature
                        tags)
  -U USESUFFIX, --usesuffix USESUFFIX
                        use a custom suffix when --suffix is provided
  -R REPLACENAMES, --replacenames REPLACENAMES
                        search for strings in the font naming tables and
                        replace them, format is
                        'search1/replace1,search2/replace2,...'
  -i, --info            update font version string

reporting options:
  -r, --report          report languages, scripts and features in font
  -n, --names           output names of remapped glyphs during processing
  -v, --verbose         print additional information during processing
  -V, --version         show program's version number and exit

Examples: pyftfeatfreeze -f 'c2sc,smcp' -S -U SC OpenSans.ttf OpenSansSC.ttf
pyftfeatfreeze -R 'Lato/Otal' Lato-Regular.ttf Otal-Regular.ttf

Tip: the -n option outputs a space-separated list of “frozen” glyphs. If you redirect it to a file, you can use this list as input for pyftsubset to create a small font that only includes the “frozen” glyphs.

Other

Problem reporting

To report a problem, open an issue. You need a Github account.

Software license and disclaimer

This tool is licensed “as is” under the Apache License, Version 2.0. By using the tool, you accept all conditions of the license, including Disclaimer of Warranty and Limitation of Liability. If you use this tool, please consult if your font’s EULA allows modifications. If the font is licensed under the OFL and uses the Reserved Font Name, please use the -R option to change the Reserved Font Name to something else.

Requirements

This tool is written for Python 3.6+, and uses fontTools/TTX.

Changelog

  • 1.32: Changes the -s (script) option so that if it’s not provided, the remapping is in all scripts.
  • 1.31: Changes the -S (suffix) option so that if it’s not provided, no sufix is added, and added the GUI apps.
  • Previously, this tool was published as a sub-tool in a fonttools-utils repo
  • The other tools of the fonttools-utils repo are now at fonttools-ttxjson and mac-os-x-system-font-replacer

Building

Python

To build the Python package, install Poetry:

pip install poetry

or

python3 -m install --user --upgrade poetry

then in the main folder of the project run:

poetry build

DMG & EXE

To build the DMG & EXE, you need macOS. In the app subfolder, run ./macdeploy all

Credits

<script async defer src="https://buttons.github.io/buttons.js"></script>

More Repositories

1

varfonts-ofl

Variable OpenType fonts under the SIL OFL license, samples and development tools & workflows
Python
58
star
2

urw-core35-fonts

Fork of defunct https://github.com/URWTypeFoundry/Core_35
31
star
3

ttfdiet

'TTF DIacritics Encoding Tool' applies a diet to a .ttf font: it modernizes the way in which glyphs for precomposed Unicode characters are stored in a TrueType-flavored OpenType font, and reduces the font's file size.
Python
28
star
4

fontsurgery-tools

Some tools for variable fonts
Shell
26
star
5

svgop

Standalone binary executables for macOS and Windows of 'svgo', the SVG optimizer
C
23
star
6

subtitle-edit-mac-wine

Way to use https://github.com/SubtitleEdit/subtitleedit/ on macOS 11
Shell
21
star
7

audiostretchy

AudioStretchy is a Python wrapper around the `audio-stretch` C library, which performs fast, high-quality time-stretching of WAV/MP3 files without changing their pitch. Works well for speech, can time-stretch silence separately.
Python
15
star
8

twardoch-fontlab-scripts

Python scripts for FontLab 7 by Adam Twardoch
Python
13
star
9

yaplon

Python 3-based commandline converter YAML ↔ JSON ↔ PLIST
Python
12
star
10

totw-fonts

TOTW (Top of the WOFFs) — collection of open-source OpenType fonts curated by Adam Twardoch
Shell
12
star
11

lorem-chatum-for-indesign

Lorem Chatum script for Adobe InDesign that uses ChatGPT to produce better lorem ipsum
JavaScript
12
star
12

split-markdown4gpt

A Python tool for splitting large Markdown files into smaller sections based on a specified token limit. This is particularly useful for processing large Markdown files with GPT models, as it allows the models to handle the data in manageable chunks.
Python
12
star
13

schticks-fonts-ofl

The Schticks Text font family is an OFL-licensed fork of the STIX Two Text fonts, with a wider weight range and a width range.
Python
10
star
14

test-fonts

Various test fonts (OpenType, OpenType with TrueType GX variation extensions, Multiple Master) for testing implementations of font formats
CSS
9
star
15

markdown-utils

Various utilities for working with Markdown-based documents
Python
7
star
16

groto-fonts-apache2

Groto is an OpenType font family based on Roboto, subsetted to some 1160+ glyphs covering the Latin alphabet. Compared with Roboto, it includes a wider range of widths.
HTML
6
star
17

dos-font-utils

Old font utils written in BASIC for DOS (now rewritten in FreeBASIC)
Visual Basic
6
star
18

gimeltra

No-nonsense simple transliteration between writing systems, mostly of Semitic origin
Python
5
star
19

monoto-fonts-ofl

4
star
20

fonttools-opentype-hinting-freezer

A tool that applies the font's hinting to the contours at a specified PPM size, and outputs the font with modified contours
Python
4
star
21

ezgooey

Simplified usage of https://github.com/chriskiehl/Gooey that turns argparse-based Python CLIs into GUI apps
Python
4
star
22

academmunicons-font

Academmunicons is a specialist variable icon font family for academics
4
star
23

mac-os-x-system-font-replacer

Python
3
star
24

markdown-steroids

Some extensions for Python Markdown
Python
3
star
25

toto-han-fonts

Source Han Sans fonts v1.001 (last Apache 2-licensed version) by Adobe from https://github.com/adobe-fonts/source-han-sans/
Objective-J
3
star
26

toto-fonts

Noto fonts from Sep 23, 2015 (last Apache 2-licensed version) from https://github.com/googlei18n/noto-fonts/
Python
3
star
27

remark-mark-plus

Plugin for remark to allow ==Text me== -> <mark>Text me</mark>
JavaScript
3
star
28

elevenlabs-tts-swagger-api

Python
2
star
29

dimjournal

Backup tool for Midjourney
Python
2
star
30

markdownlp

Collection of NLP tools for Markdown (mostly using Python)
Python
2
star
31

multinpainter-gui

GUI for automatic iterative outpainter powered by OpenAI Dall-E API
Python
2
star
32

fonttools-ttxjson

Python
2
star
33

pypolona

Search the Polona.pl website of the Polish National Library and download all images from publications
Python
2
star
34

mkdocs-text-export-plugin

MkDocs Plugin to convert the pages to plain text
Python
1
star
35

keynote-slides-freezer

A Python tool to "freeze" a Keynote slidehow: keeps only text objects that use specified fonts as text, exports to PDF slides from the rest and builds a new deck that has the PDFs plus the "safe" text boxes
Python
1
star
36

googlefonts-images

images of all Google Fonts
Python
1
star
37

font-copywriter

Tool to automatically produce human-readable descriptions of a font family
1
star
38

udhr-custom

Custom work around the Universal Declaration of Human Rights in Unicode
Python
1
star
39

split-python4gpt

A Python tool for splitting large Python projects into text files based on a specified token limit. This is particularly useful for processing large Python codebases with GPT models, as it allows the models to handle the data in manageable chunks.
Python
1
star
40

feaLab

Tools for dealing with OpenType Layout features and the AFDKO FEA language
Python
1
star
41

pdf2svg2pdf

CLI tool and Python library that splits a multi-page PDF into single pages, converts them to SVG, applies some modifications, converts back to PDF and makes a new multi-page PDF
Python
1
star
42

macos-surgery

Various personal macOS things
Shell
1
star
43

pyhecate

Automagically generate thumbnails, animated GIFs, and summaries from videos. Python CLI wrapper for https://github.com/twardoch/hecate
Python
1
star
44

remark-kbd-plus

Plugin for remark to allow ++Cmd++ -> <kbd>Cmd</kbd>
JavaScript
1
star