Skip to main content

Hello!


I’m trying to recover the letterSpacing value of a TextNode through PluginAPI. I’ve set some of my TextNodes to have a letterSpacing of 0.16px and others to 0.45px and I want to get that value in my Plugin.


However, every TextNode, those which have a modified letterSpacing and those which don’t have this value inside ‘letterSpacing’:


letterSpacing: {

unit: “PERCENT”

value: 1

}


Is there any other way of getting letterSpacing? I’ve checked and I’m retrieving the correct nodes.

I can’t reproduce. I set the spacing to 0.12px:



Can you share a test file?


The letterSpacing I’ve set:



The answer I get:



I tried isolating the TextNode in a different page so I’m getting the same node 100%.


I’m guessing it must be due to how / where the designer set the letterSpacing. We will check it. I tried to retrieve the TextNode using the Chrome Developer Tools as you did and I’m getting the same response as always.


Thanks



Is this from Dev Mode?


Can you show what the setting looks like in UI?


Exactly that, I just checked and that 0.16px is basically 1% of the fontSize. In the normal UI it’s set to 1%.


Thanks, you have been very helpful. 🙂


If you need 0.16 instead of 1% you can try using textNode.getCSSAsync() and it should return the value similar to dev mode https://www.figma.com/plugin-docs/api/TextNode/#getcssasync but I’m not certain, haven’t tested.