ftCLI / FoundryTools-CLI

A collection of command line tools to inspect, manipulate and convert font files
https://ftcli.github.io/FoundryTools-CLI/
MIT License
85 stars 4 forks source link

Feature request: add variable font naming scheme to `ftcli utils font-renamer` #191

Closed vitorsr closed 3 weeks ago

vitorsr commented 3 weeks ago

It would be interesting to have a differentiated naming scheme for variable fonts in order to avoid clashing with static and variable instance fonts.

Plus, it is often the case variable fonts have a default instance name that may not be descriptive.

In my view this would entail adding a flag to opt into/select the naming scheme specific for variable fonts.

There is no blessed way to rename variable fonts, and I find the least bad approach is the way Google Fonts does it:

https://googlefonts.github.io/gf-guide/variable.html#variable-font-filenames

Here is how it is implemented (this is used by gftools):

https://github.com/google/fonts/blob/v0.4.9/Lib/axisregistry/__init__.py#L564-L578

Note: only ital, opsz, slnt, wdth and wght are recognized registered axis tags in the OpenType specification.

ftCLI commented 3 weeks ago

Very useful, thanks!

For the moment, I've implemented this in the repository I'm using to build ftCLI 2: https://github.com/ftCLI/FoundryTools-CLI-2/pull/357

The implementation uses all axes to build the filename, except the hidden ones.

If you don't mind cloning that repo, the usage is: ft-cli utils font-renamer

(using ft-cli, with the dash, allows using both side by side)

Later I'll see how to implement this on ftcli

ftCLI commented 3 weeks ago

Done here too, just pushed a new release: https://github.com/ftCLI/FoundryTools-CLI/releases/tag/v1.1.18

vitorsr commented 3 weeks ago

Thanks!

If you don't mind cloning

No need, really! For CLI usage a quicker and easy way is to do this:

$ pipx install git+https://github.com/ftCLI/FoundryTools-CLI-2.git

This will place a ft-cli symlink in $HOME/.local/bin which of course needs to be on the path so we can call it.

In fact - pip also accepts installing from git with that syntax, but I would recommend pipx as the recommended way to use it as it will create an isolated venv that will not clash with other system or user packages.

(using ft-cli, with the dash, allows using both side by side)

Thanks! I'm particularly biased towards adding -ng for complete rewrites (next generation, see, e.g., [1]) if you are open to suggestions, though a v2 major version increment also makes sense here.

[1] https://askubuntu.com/questions/46596/what-does-the-ng-suffix-mean-in-package-names

ftCLI commented 3 weeks ago

Thanks! Very useful information.

For sure the '-ng' suffix is far better than '-2'. I will rename the repository and refactor the code asap