Skip to main content
Jul 20, 2023 7:47 PM UTC
Solved

Is it possible to split a text layer into two or more layers?

For example:

$19.99
/month

separate it into two layers where $19.99 is one layer and /month is another

This topic has been closed for replies.
David
DavidSolution
New Participant
Jul 20, 2023 8:32 PM UTC

There are existing plugins which have this functionality. Here’s one example:

Figma

8 replies

David
DavidSolution
New Participant
Jul 20, 2023 8:32 PM UTC

There are existing plugins which have this functionality. Here’s one example:

Figma
Jul 20, 2023 8:35 PM UTC

Im aware of that. I want know how to do it through the plugin api.

David
New Participant
Jul 20, 2023 9:34 PM UTC

One of the currently available plugins has their source code available on GitHub. Take a look through there to see how they are handling it.

github.com
Jul 20, 2023 9:34 PM UTC

cool. thank you.

Vincent_Huss
Active Member
Mar 28, 2024 4:48 AM UTC

he’s only doing a split(‘\n’)
not handling :

  • the weird L-SEP char that appear if user does shift+ENTER (known issue)
  • natural text wrapping

anyone knows if the Figma API provides any sorts of info about the lines of text generated by the text engine ? i really can’t find anything

fengweiyao
New Member
Sep 10, 2024 1:30 PM UTC

@Vincent_Huss hi, do you have any solution now? i have the same issue.

Vincent_Huss
Active Member
Sep 11, 2024 2:43 AM UTC

no, i gave up on that feature,

it doesn’t seem like Figma provides any hook for that information 😕

maybe something to consider as a feature request @Figma_Product ?

=> for a text node : providing a list of bounding box for each lines

James_Yang
Figmate
Figmate
Sep 11, 2024 10:22 AM UTC

There was another thread on something similar from earlier this year: Methods and/or Properties for Getting Dimensions of Lines of Text within Text Node?