Skip to main content
aamir.shaikh
April 14, 2023
Question

Why does the getStyledTextSegments() function return incorrect end value?


TextNode.getStyledTextSegments([‘fontName’]) returns incorrect end value. Here, the word is ‘Spline’, which contains 6 characters. So, the end number should be 5, since we are starting from 0.

This topic has been closed for replies.

1 reply

tank666
April 14, 2023

Everything is correct here. Starting from 0 to 6. Where 0—position before the text characters; 6—position after text characters.

But what if you entered only one character, then the start would be equal to the end, i.e. 0? This is fundamentally wrong.

UX/UI designer. Figma expert. Creator and developer of plugins and widgets for Figma and FigJam. Check out my resources in Figma Community: figma.com/@tank