View on GitHub

samsa

Variable font inspector

Samsa-CLI

Samsa-CLI (samsa-cli.js) is a Node.js command-line utility for performing operations on variable fonts (VFs). It uses the Samsa-Core library, so it requires samsa-core.js, as well as Node.

Installing Node.js

Download Node.js for your platform.

Arguments

--instances "<instanceDef[;instanceDef]>"
Introduces a list of instance definitions, separated with “;”. Use quotes to avoid space and semicolon being handled incorrectly by the shell. An instance definition may be:

--instance, -i
Synonyms for --instances.

--output, -o <filename>
Outfile filename, overrides default “samsa-instance”.

--optimize, -O <memory|speed|size>
Optimize for low memory, high speed, instance size (default = speed), comma-separated. Note that very large fonts may require the “memory” optimization.

--quiet, -q
Quiet mode, no console output.

--list, -l
List instances, do not write any files.

Examples

Print out this short help info:
% node samsa-cli.js

Make static fonts for all named instances:
% node samsa-cli.js Gingham.ttf --instances named

Make static fonts for all named instances (switching to short -i syntax):
% node samsa-cli.js Gingham.ttf -i named

Make static fonts for all named instances optimized for smaller output size and low memory usage:
% node samsa-cli.js Gingham.ttf -i named -O size,memory

Make static fonts for all stat instances:
% node samsa-cli.js SourceSans.ttf -i stat

Make a static font for the custom instance at wght 245, wdth 89:
% node samsa-cli.js Skia.ttf -i "wght 345 wdth 89"

Make a static font for the default instance:
% node samsa-cli.js Skia.ttf -i default

Make static fonts using multiple instance specifications separated with “;”:
% node samsa-cli.js Skia.ttf -i "named;stat;wght 345 wdth 89;wght 811 wdth 180;default"

Performance

Initial tests indicate that it is much faster (approx. 40x) than fontTools at instantiation.

Limitations

The static fonts exported are not yet production ready. Limitations include:

Exporting production ready fonts will depend on improvements to samsa-core.js.