All Projects → twardoch → Fonttools Opentype Feature Freezer

twardoch / Fonttools Opentype Feature Freezer

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

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Fonttools Opentype Feature Freezer

rapid-arrows-font
OTF comic font
Stars: ✭ 30 (-76.92%)
Mutual labels:  font, opentype
Libertinus
The Libertinus font family
Stars: ✭ 518 (+298.46%)
Mutual labels:  font, opentype
Xits
XITS - OpenType implementation of STIX fonts with math support
Stars: ✭ 257 (+97.69%)
Mutual labels:  font, opentype
font-v
Font version string reporting and modification library + executable tool
Stars: ✭ 15 (-88.46%)
Mutual labels:  font, opentype
Fonthx
Font File Generation in Haxe
Stars: ✭ 64 (-50.77%)
Mutual labels:  font, opentype
emojione-color
OpenType-SVG font of EmojiOne 2.3
Stars: ✭ 112 (-13.85%)
Mutual labels:  font, opentype
Fontdue
The fastest font renderer in the world, written in pure rust.
Stars: ✭ 499 (+283.85%)
Mutual labels:  font, opentype
fdiff
An OpenType table diff tool for fonts. Based on the fontTools TTX format.
Stars: ✭ 33 (-74.62%)
Mutual labels:  font, opentype
Source Han Serif
Source Han Serif | 思源宋体 | 思源宋體 | 思源宋體 香港 | 源ノ明朝 | 본명조
Stars: ✭ 5,920 (+4453.85%)
Mutual labels:  font, opentype
Source Han Mono
Source Han Mono | 思源等宽 | 思源等寬 | 思源等寬 香港 | 源ノ等幅 | 본모노
Stars: ✭ 591 (+354.62%)
Mutual labels:  font, opentype
Adobe Variable Font Prototype
Variable font example in OpenType-CFF2 & TrueType formats
Stars: ✭ 116 (-10.77%)
Mutual labels:  font, opentype
Source Han Sans
Source Han Sans | 思源黑体 | 思源黑體 | 思源黑體 香港 | 源ノ角ゴシック | 본고딕
Stars: ✭ 10,181 (+7731.54%)
Mutual labels:  font, opentype
chiron-sans-hk
昭源黑體:現代筆形風格,平衡標準字形和印刷體慣用筆形的免費開源黑體字型
Stars: ✭ 131 (+0.77%)
Mutual labels:  font, opentype
bitsnpicas
Bits'N'Picas - Bitmap & Emoji Font Creation & Conversion Tools
Stars: ✭ 171 (+31.54%)
Mutual labels:  font, opentype
xits
XITS - OpenType implementation of STIX fonts with math support
Stars: ✭ 299 (+130%)
Mutual labels:  font, opentype
Opentype.js
Read and write OpenType fonts using JavaScript.
Stars: ✭ 3,393 (+2510%)
Mutual labels:  font, opentype
punk-otf
Punk Nova - an OpenType implementation of Donald Knuth's Punk font
Stars: ✭ 37 (-71.54%)
Mutual labels:  font, opentype
perplexed
OTF monospace typeface, a derivative of IBM Plex Mono with Powerline glyphs added
Stars: ✭ 23 (-82.31%)
Mutual labels:  font, opentype
Rusttype
Mirror of https://gitlab.redox-os.org/redox-os/rusttype
Stars: ✭ 521 (+300.77%)
Mutual labels:  font, opentype
Free Font
大概是2020年最全的免费可商用字体,这里收录的商免字体都能找到明确的授权出处,可以放心使用,持续更新中...
Stars: ✭ 1,140 (+776.92%)
Mutual labels:  font, opentype

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>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].