Skip to main content
Zhihao_Cui1
New Member
August 29, 2023
Solved

Efficient way to query partial superscript

With recent update, we can access superscript property of text layers via getRangeOpenTypeFeatures. However, in most situations I encountered, superscript content is only very small portion of a paragraph. getRangeOpenTypeFeatures will give figma.mixed for text block which contains text with and without superscript at the same time. To accurately get which portion of text is superscript, we need to iterate characters one by one and check for SUPS: true.

However, there is getStyledTextSegments which enables batch query of styled text (e.g. font name, font size) and returns an array of properties.

It would be great we can access some API which is similar to this?

This topic has been closed for replies.
tank666
tank666Solution
August 29, 2023

getStyledTextSegments works with openTypeFeatures.

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

2 replies

tank666
tank666Solution
August 29, 2023

getStyledTextSegments works with openTypeFeatures.

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
Zhihao_Cui1
New Member
August 29, 2023

Good to know. Didn’t see the doc being updated.