Text Object scripting

Text object questions, hoping for JS solutions:

Can a block of text have a font and then the dynamic text inside be assigned a different font?
Can the dynamic text be replaced with an image?

For example:
“Block of text with {username} in the same block of text”

But replacing username a different font.
Replacing username with an image from an array.

I’m unsure how to capture these from the API, or if it’s possible.
script.textComponent. ?dynamic-text?

API: Lens Studio by Snap Inc.

I think that would be pretty difficult to manage in lens studio. There isn’t any built in text measurement API or html formatter, as far as I know.

This would complicate things a lot, but you could probably manage it with a camera kit app. You can have the app do the fancy text generation, and then pass it in as a texture to the effect.

Otherwise, if you know the location and size of the text to replace within a texture, then you could make a render target for rendering the text to an image and then do some transformations to make it fit. It’ll just be a little weird because the surrounding text won’t re-flow around the dynamic text.