source-foundry / Slice

An open-source, cross-platform GUI app to generate custom font design spaces from variable fonts
https://slice-gui.netlify.app/
GNU General Public License v3.0
155 stars 9 forks source link

Slice does not seem to activate axis-based (rvrn) substitutions #109

Open Shrinks99 opened 1 year ago

Shrinks99 commented 1 year ago

I'm trying to create a single cut of the excellent Recursive with its mono axis set to 0.51. At this value a bunch of characters are substituted for their monospaced slab-serif alternates (check out r which is substituted for r.mono). Unfortunately when I set up slice with a mono value of 0.51 it does not perform this substitution, and because the typeface is output as a single axis I cannot select this substitution in most (any?) software as it's a contextual alternate and won't appear in a stylistic set or ligatures option.

It would be helpful to have the option to bake those types of character substitutions specifically into the sliced font file? Somewhat niche use case, I know!

Otherwise this tool works quite well and is very helpful! Thank you for making it :)

kenmcd commented 1 year ago

The r.mono substitution is also affected by cursive (CRSV). ~cr<0.09&0.5<mo, ~cr<0.9&0.5<mo&-14.99<sl And it appears Slice does not automatically use the default. When I set CRSV to 0 or 0.5 it seems to work. The image below is the result with:

CorpSemiMono-Regular-preview

Here is the font: CorpSemiMono-Regular.ttf.zip

Also exported an OTF from FontLab with the same settings: CorpSemiMono-Regular.otf.zip

So Slice appears to work if you specifically set the axes.

Shrinks99 commented 1 year ago

Hey! You know exactly what issue I'm trying to solve! Thank you for being so helpful regarding this issue (across two different sites nonetheless!) :)

Windows' font viewer seems to result in a different output than what the typeface actually displays in certian applications, specifically Affinity Designer which was a bonus struggle when trying to nail down what the actual issue was? Perhaps something that Affinity Designer is doing here is unstandard and this could be a bug on their end (I will go ahead and close this if you think that's the case), but after testing in Inkscape and Figma (both of which support variable fonts) your output is identical to Recursive with similar settings. In Designer the r and similar monospace axis substitutions still aren't swapped out properly?

Figma

Screenshot 2023-03-22 182250

Affinity Designer

Screenshot 2023-03-22 182319

Weird eh?

kenmcd commented 1 year ago

Interesting... I can see the issue.

The .ttf font from Slice uses the Required Variation Alternates (rvrn) OpenType feature to replace the characters. And APub is not processing the rvrn feature apparently. Which is a bug.

The .otf font from FontLab is swapping the alternates into the normal character codes - so they just work. Try that one and you will see.

Since the font from FontLab does work in APub as expected... Why don't we take the discussion back to the Affinity forum. OK to use that same thread - others will benefit. Tell me exactly what you are trying to do. Such as make your own R/I/B/BI corp font set. ? ? or? And exactly what the axes settings are supposed to be, etc.

kenmcd commented 1 year ago

@chrissimpkins Should Slice be using rvrn for a static font? Based on the OpenType specs it appears to be only for variable fonts "and is always used in conjunction with a FeatureVariations table". So it really does not make sense to me that when creating static fonts, primarily for applications which do not support variable fonts, that the rvrn feature is used. What is the thinking here?

Shrinks99 commented 1 year ago

Briefly looking at the code it seems Slice actually calls FontTools for creating the instance... Perhaps I've opened this issue in the wrong repo? I can confirm that FontTools' instantiateVariableFont function results in the same issue when using it through the CLI.

EDIT: Have opened a discussion question in the FontTools repo discussions: https://github.com/fonttools/fonttools/discussions/3057

kenmcd commented 1 year ago

Briefly looking at the code it seems Slice actually calls FontTools for creating the instance... Perhaps I've opened this issue in the wrong repo? I can confirm that FontTools' instantiateVariableFont function results in the same issue when using it through the CLI.

Hmmm... I wonder if there is a function in fonttools which could affect how that is done (if Yes, that should be an option in Slice). The fonttools guys are very helpful when you ask specific questions - so you may want to ask there.

And how is it being done when the Recursive statics are built?

Shrinks99 commented 1 year ago

As my final(?) update to this issue, this is not a feature currently built into fontTools and as such, is not built into Slice. In order to solve it (thanks to the helpful suggestion from Jens Kutilek in that GH Discussions thread) I used OpenType Feature Freezer to freeze the rvrn tags after using Slice to generate the instanced font file.

I will leave this issue open to track the status of it being added to fontTools? If a corresponding issue is made over there I'll link it here. :)

EDIT: Here's the fontTools issue: https://github.com/fonttools/fonttools/issues/3128

davelab6 commented 1 year ago

@behdad should this be added to fontTools?

behdad commented 1 year ago

Yes, this sounds like something the fonttools instancer should do. I'll follow up in https://github.com/fonttools/fonttools/discussions/3057