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

TextTexture does not handle Chinese text well #450

Closed
Moussa opened this issue Feb 10, 2023 · 5 comments · Fixed by #473 or #474
Closed

TextTexture does not handle Chinese text well #450

Moussa opened this issue Feb 10, 2023 · 5 comments · Fixed by #473 or #474

Comments

@Moussa
Copy link
Contributor

Moussa commented Feb 10, 2023

We've observed that Chinese text within TextTextures do not line break correctly, resulting in Chinese text being rendered as a single long line that overflows the container. Perhaps Lightning should be applying https://en.wikipedia.org/wiki/Line_breaking_rules_in_East_Asian_languages? We've worked around this internally by adding a space after characters defined in https://en.wikipedia.org/wiki/Chinese_punctuation, but it would be great if Lightning could handle this internally. Other non-latin languages are likely affected.

@uguraslan
Copy link
Contributor

@Moussa Thank you for bringing this to our attention. To better understand the issue and reproduce it, would you be able to provide a sample app that can be created by using the Lightning playground tool? It would be great if the sample app contains your work-around as well.

@Moussa
Copy link
Contributor Author

Moussa commented Mar 6, 2023

Hi @uguraslan. Sure thing, this playground app shows the issue with some sample Chinese text. If you replace the original text input with the parseNonLatinPunctuation parsed input you'll see improved text rendering behaviour.

https://lightningjs.io/playground/#N4IgJgpgDhB2mwMYEsIGcQC5QAEA2yA5gBYAusyshAVmgPSID2AThFiGaVGpnQ2LAB0aANYBPKAENEIwZABudfETIUqtBiwg4ATIICcggAwgANCGUlylGvTRgR7Tt178hoidNkKlBK2ts6exEcABZBAA5BAGYQAF9zNERmZChSDGwQPEkAVyRiQVosUAAzZDw2TCzc-MKMcyZIdmQAWygWUgACAEEoKE6S5kYWzoByQTpeqDrRgG4AHVhFplg0LsY05EZVzoBeTuA1yUIITAOAdzP9ADYjU07iM4BWULvOxArJZgBhRjwWM5GAAeRlBYNBcTiCyQ2zWnUkfT2nVgEHOPT6AAoNqQtqsAJTQsCMRA5FpwUiCABGjDAYkECJg8G+xH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WAFQ84w9NBVT+fG6CTuxwHtNdFnlf2ZH3tgOnKRWJnORt7nzk13b3tF43nTN505wsuWfcD7iHd3d3dpTzP3Ot1yg9jHbKeUunQYlwAtEw-xLHnO8lD7kjpyf2xRcPBe3RE6eTwG5Ky2gyBoMnt36Mvvdv1gLtdAX974B1rtdaIe9x6TzQFnL43MxZeAgFXZyECSjRC7uPHuZBXLwKZkgmQKCwHby9r7IwL8IB01FtkGQE9yTIBJNkZgosNpENQaQuuPsY4WwDjgrolJaGSwqEAxhKsvisOQRwh+dcjDPxgVQrogpCDl0ISIYh58yFGD-tgleyjVFsPUdI8BI9QTXwUdQokORBHc30YgwxGi0GmKMNA3hnR+EV2seXOxkj2GLHVKpFYcJJBgDAPlKQLU0AACUIAnHUkiFEaIYmEAAKLqQxMrVW6tdpa2xoWagjBKAYlGAAH1GPNMYhBymqQrBpHmVCdJK0mkmQmWZxq5PsrNEyeJArOVCjkcKaUTKCFYFAWhEB2ShPCdIdAyTan3FGAAEgAGRjAJIsD6P1pTwDgHKQGmotRckpBkEAkhVbxCAA

@uguraslan
Copy link
Contributor

@Moussa Thank you for providing a sample code with the playground app. We will be looking into it and will inform you when we have a solution for the issue.

@frank-weindel
Copy link
Contributor

@Moussa We are going to give the developer the capability of inserting zero-width breaking spaces (Unicode: 0x200B) at any point they wish and the Lightning text renderers will use them as line breaking opportunities in addition to normal space characters. This will allow you to use the function you've defined in your example without having to insert artificial space characters which actually affect the display of the text when word wrapping does not occur.

We'll consider adding in more intrinsic support for non-Latin scripts in a plugin friendly way in the future, specifically with Lightning 3.0. But for now this feature should enable developers to implement deterministic word wrapping in a way that was not possible before.

frank-weindel added a commit that referenced this issue Apr 6, 2023
Fixes #450 (or at least enables developers to work around the problem)
@uguraslan uguraslan linked a pull request Apr 13, 2023 that will close this issue
@uguraslan uguraslan added in-review A change related to an issue is in PR review fix-in-review This issue has a PR in review and removed in-review A change related to an issue is in PR review labels Apr 13, 2023
@uguraslan uguraslan mentioned this issue Apr 17, 2023
2 tasks
@uguraslan uguraslan linked a pull request Apr 17, 2023 that will close this issue
2 tasks
@uguraslan uguraslan added fixed and removed fix-in-review This issue has a PR in review labels Apr 20, 2023
@uguraslan uguraslan added this to the Lightning v2.10.0 milestone Apr 20, 2023
@Moussa
Copy link
Contributor Author

Moussa commented May 9, 2023

Thank you for the addition 👍.

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