Skip to main content
Solved

Efficient way to query partial superscript

  • August 29, 2023
  • 2 replies
  • 238 views

Zhihao_Cui1

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?

Best answer by tank666

getStyledTextSegments works with openTypeFeatures.

This topic has been closed for replies.

2 replies

tank666
  • 4873 replies
  • Answer
  • August 29, 2023

getStyledTextSegments works with openTypeFeatures.


Zhihao_Cui1
  • Author
  • New Member
  • 2 replies
  • August 29, 2023

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