Hi Using variables for setting fonts are cool and helps our design system a lot.
But is there any way to set bound variables for text properties via Plugin API?
It’s complex read-only property and simple setBoundVariable() does not work. We don’t have known methods like setBoundVariableForFont().
Can we wait for Plugin API to support typography variables any time soon?
List of properties I can’t manage to set:
fontFamily, letterSpacing, fontSize, paragraphSpacing, paragraphIndent, fontWeight, lineHeight and unexpectedly stroke for sections
I’m trying to reference the variable id in a function using boundVariables.fontSize.id, but it’s returning undefined. Other id references like fills[0].boundVariables.color.id and boundVariables.strokeWeight.id work fine. Any thoughts?
boundVariables.fontSize.id doesn’t work because for VariableBindableTextField keys in the boundVariables object, because the values are arrays of aliases instead of just a single alias.
The reason is that unlike normal bindable fields like strokeWeight, you can bind different variables to substrings of text. So you need to do boundVariables.fontSize[0].id (after checking that the array is non-empty).