Is there a way to update this expression so that the text starts a new line after every X amount of pixels rather than X amount of characters? Is it possible to measure the length of the text using .sourceRectAtTime().width and have the text start a new line after it reaches the desired width?
I’ve recently used this expression for a “textbox” .mogrt I’m making, but realized that if the inputted text has any return characters in it (i.e. manual line breaks) then the text in the subsequent paragraphs start getting line breaks in unusual places — as if the character count function gets thrown off somehow.
There also appears to be a “space” character that’s placed in the very beginning of the text that doesn’t exist in the text itself.
Does anyone have any ideas on how to remedy? The code is (unfortunately) a little outside of my ability, so I’m not sure how to troubleshoot it.
You’ll notice some code is commented out — these were my (failed) attempts to find/replace carriage returns with a symbol, then run the code that determines where line breaks should go, then restore the symbols to carriage returns again.
I also tried replacing \r with \n in the original code to see if that’d resolve whatever conflict was occurring, but that had no effect either.
Super script. If I transfer the text to a new line manually, then on the second line the script continues to count characters and the transfer to a new line will be done earlier. How to make the script work on the new magpie first? Dan, thank you so much