text-to-styles
text-to-styles copied to clipboard
Text styles generating wrong weight
Hi @tbrasington,
Just trying out your plugin. Sweet work 👍
I'm encountering a small issue when generating styles. For a specific style i'm specifying 'Heavy' as a weight. However upon generating the styles 'Extra Bold' is generated as a style. I manually override this for now, but just wanted to give you a heads up on the issue.
Cheers
Hi @bitfactory-lasse-vandenboschchristensen thank you for the heads up. Let me check if its resolvable – there was an issue with how Sketch was handling font weights that was being looked at.
@tbrasington rock on :)
@tbrasington I am having a similar issue with a Light font. Instead of the Light weight, it is generating a Thin font.
Hey folks, what typefaces are you using? I can hopefully expand them for my testing.
Awesome. Thanks! Fonts are ... SF Pro Display and SF Pro Text
Hey everyone. So it seems that isn’t going to be possible with the current Sketch JS API.
So for example in the San Francisco case thin and light both report back their weight is 3. This is as the internals in the sketch api are using this function (https://developer.apple.com/documentation/appkit/nsfontmanager/1462351-weightoffont?language=objc) here (https://github.com/sketch-hq/SketchAPI/blob/26b1fe92a89871e2db8ec04ccc8af49c735407cd/Source/dom/style/Text.js#L491)
This only gives an approximation of the font weight which falls down when the font file isn’t mapped out in a certain way.
Just had this bug too with TT Commons. What a shame!
Just had this bug too with TT Commons. What a shame!
It is possible to get around it if you have tools to adjust the font properties. Some reading here https://github.com/ingrammicro/puzzle-tokens/issues/19