silnrsi / smith

font development, testing and release
Other
14 stars 5 forks source link

Smith shortcircuit produces incorrect axis values #75

Open jvgaultney opened 2 years ago

jvgaultney commented 2 years ago

Smith currently ‘shortcircuits’ the generation of fonts that have the same weight name as masters, but this skips the step where the axis mapping is applied. For example in Lisu Bosa the ExtraLight and Black weight values are incorrect. We've had to work around this but turning off shortcircuit (shortcircuit=false in the designspace), however that slows down builds.

The shortcircuit mechanism needs a redesign for axis-based fonts, as matching via weight name is no longer valid. Either the matching algorithm needs to be improved (effectively reducing the number of situations in which shortcircuit is applied), or shortcircuit needs to hack the shortcircuited fonts to fix the metadata.

jvgaultney commented 2 years ago

A thorough way to test this would be to take a couple of our axis-based projects (Lisu Bosa, Namdhinggo) and build them with and without shortcircuit=False. Then compare and fix Smith as needed until the resulting fonts are identical in all metadata values.

devosb commented 2 years ago

Dai Banna SIL is another good project to test with. It requires shortcircuit = False, otherwise there are some issues

If shortcircuit = False is specified, all instances are created using psfcreateinstances. If the shortcircuit statement removed then the light (and italic) and bold (and italic) weights are not created using psfcreateinstances, they are created directly from the UFO masters using psfufo2ttf. I think this explains why the above two issues occur. So I think there is one issue in the hadling of italic for the light weights in psfufo2ttf for @DavidRaymond and another issue, as @jvgaultney mentioned for @mhosken with the shortcircuit logic for the bold style weight values.

Possibly there is no issue with psfufo2ttf since the shortcircuit logic is calling psfufo2ttf when it really should be calling psfcreateinstances. At one point, in addition to the issue with the italic bits, both light styles had name ID 17 set but not ID 16. I cannot reproduce the issue with the name IDs at this time.

The font manifest is not generated unless the shortcircuit statement removed.

mhosken commented 2 years ago

Much of this has been fixed with sorting out axes. But it does expose a bug in psfufo2ttf (well in ufo2ft) whereby a style of Light Italic gets mapped to a font name of Light Italic and style Regular, rather than a font name of Light and style of Italic. Perhaps this can be fixed in the UFO?

mhosken commented 2 years ago

I was able to get shortcircuit results to fit with non shortcircuit results by setting the familyName to SIL Dai Banna Light and styleName to Regular/Italic while leaving the openTypePreferredNames as they were.

Ugly but it works. Alternatively set shortcircuit=False for anything with Light in it.