-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Span for Text element #269
Comments
Funny because I just asked the question on Discord. LightningJS 2 has an "advanced text renderer" which supports basic markup for multi-style text. |
@frank-weindel thoughts? |
HTML-based rich text is possible. The functionality from the advanced text renderer for Canvas text could be ported. For SDF text it's tricky but doable. |
It is otherwise really awkward/inefficient to create a label (especially multiline) with multiple styles. |
@frank-weindel - If we were to do this on the Framework side...
If I created two text nodes to do this vs you doing it on the renderer... Would they be equal in performance? @CosmaVergari - What types of styling would you need? (Italic, bold...) I think Solid can do some of this now you just put multiple nodes with different props and put it inside a Flex container. Multiline would be hard on the framework side. |
I'm trying to put a different color and size to a text at the beginning of a multi-line paragraph (for specific reasons), I don't think it is reliably achievable with the framework as you said. |
@chiefcll You don't really have access to the raw text layout data at that level. While you might be able to approximate it at the framework level, it will never be 100% correct. |
@chiefcll there a few cases where flexing elements can be an acceptable workaround, but creating many nodes doesn't scale well, and it certainly won't work for multiline text. Indeed |
Hi Lightning team!
I have a question/proposal: is it possible to implement a syntax to have a portion of text in a Text element of a different style w.r.t. that of the Text element (e.g. a bold word in a normal sentence)?
Similarly to what is achieved in HTML using the <span> tag.
The text was updated successfully, but these errors were encountered: