Skip to content
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

Regression with rendering text that uses normal spaces #488

Closed
itsjamie opened this issue May 26, 2023 · 3 comments · Fixed by #489 or #507
Closed

Regression with rendering text that uses normal spaces #488

itsjamie opened this issue May 26, 2023 · 3 comments · Fixed by #489 or #507
Assignees
Labels

Comments

@itsjamie
Copy link
Contributor

Having a text texture with extra non-breaking space characters in a text element that has wordWrapWidth enabled seems to have regressed with the implementation of the Zero Width Spaces for languages like Chinese.

If you take the string reproduction , and run it through the splitWords function, the space character is dropped from the returned match, leading to the space no longer being considered part of the rendering.

@itsjamie
Copy link
Contributor Author

We used this feature to support rendering text that changed colors in the middle of strings.

So, if there is another better method for doing wordWrapWidth and allowing for <span style="color: red">Red</span> Text, then it doesn't matter.

But what we were looking to resolve was..

Welcome to the NEW version of our application. The text is very long and will overflow, but we want certain text to be different colors to draw attention.

So we would instead write:

Welcome to the ___ version of our application. The text is very long and will overflow, but we want ____________ to be different colors to draw attention.

Then we could render the small sections of text, calculate where they should go, and then place them in those empty spots.

This kept the overall word wrapping algorithm working and allowed for the alignment to be correct. With this, that strategy no longer works. But, if there was a better way to handle inline text colourization that wouldn't matter!

@frank-weindel
Copy link
Contributor

Thanks @itsjamie for the report. Have you looked into the Advanced Text Renderer at all for what you're trying to do? https://lightningjs.io/api/lightning-core/interfaces/lightning.textures.texttexture.settings#advancedRenderer

@itsjamie
Copy link
Contributor Author

itsjamie commented May 31, 2023

That's exactly the kind of pointer I was hoping for we had missed. Thanks @frank-weindel. I'll get us to convert this particular section of code.

It also has made us change to using padding in a few other places where prior we had used whitespace. I wouldn't consider this a high priority in comparison, but will keep it open in case others also relied on the spaces not being trimmed for other reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment