MuTsunTsai / fontfreeze

Freeze variations and features in font.
https://mutsuntsai.github.io/fontfreeze/
MIT License
113 stars 1 forks source link
font fonts opentype truetype typeface

FontFreeze

GitHub package.json version GitHub Repo stars

FontFreeze - Freeze variations and features in font | Product Hunt

Freeze variations and features in font.

Introduction

Modern OpenType fonts support variations and features that allow customizable fonts. The problem is that not all environments support these mechanisms. IDEs such as Visual Studio only support choosing font family and font size, without any options to select variants or toggle features. FontFreeze is a tool that allows you to create a customized instance of a given font, so that you may use exactly the font you want in those environments.

How to use it

Simply visit https://mutsuntsai.github.io/fontfreeze to launch the app, no installation required!

As you open a .ttf file, it will show you the font info and the available options. You can then select a particular variant (for variable fonts) by selecting one of the predefined instances, or customize each variable axis. You can also select features you want to activate (or deactivate) from the feature list:

Finally, click Generate font! to generate your font. It's that simple!

Tips:

How it works

FontFreeze uses fonttools, a Python library for manipulating fonts. In then utilizes Pyodide to run Python code directly in your browser through WebAssembly, so it's purely front-end and nothing is stored in the back-end. The UI part is built with petite-vue and Bootstrap.

The way FontFreeze deactivates a feature is by removing all lookups inside it, and it activates a feature by moving all lookups in it into calt, which is usually activated by default in most environments. If this doesn't work for a particular environment, you may also try changing the "Target feature for activation" setting to rvrn (which is more forced than calt by the OpenType specification; note that in this case, you might also need to activate calt as well for some other features to function).

Since version 1.3, in addition to the said approach, there is also an option to apply actual glyph substitution for single-glyph features (which is on by default) for maximal compatibility across different environments.

Acknowledgment

FontFreeze is especially inspired by the project vfit, and I used many parts of the source code from it. Other projects that inspired FontFreeze include:

The "FontFreeze" banner is generated using Text Generator.