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

Wrapping CJK text in the UI #2939

Open
NaitLee opened this issue Mar 2, 2024 · 5 comments
Open

Wrapping CJK text in the UI #2939

NaitLee opened this issue Mar 2, 2024 · 5 comments
Labels
A-Translation Anything touching translation problems. Tightly coupled with A-UI A-UI T-Bug

Comments

@NaitLee
Copy link
Contributor

NaitLee commented Mar 2, 2024

Currently layout of CJK text is awkward: it only breaks after spaces (in CJK paragraphs, spaces are few and only around emoticons here), and won’t break a span of CJK characters.

Screenshot_20240302_140810

I’m unsure if sole RCSS could fix the problem. Or upstream RmlUi layout system didn’t really take care about this.
(though I tried white-space: normal and word-break: break-all and they didn’t work)

This problem shouldn’t affect gameplay too much though, given in-game UI have short strings.

@Grise3
Copy link
Contributor

Grise3 commented Mar 2, 2024

Hi @NaitLee!
This is a known bug. (not for the text in the windows, but sometime it happens for buttons, ect.)
I'm going to correct it.
Thanks for reporting the bug!

@sweet235
Copy link
Contributor

sweet235 commented Mar 2, 2024

One rather easy solution might be to insert a zero width space after each character, see https://en.wikipedia.org/wiki/Zero-width_space. We could do this automatically. Any automatic method would be preferred over inserting the line breaks manually.

@sweet235
Copy link
Contributor

sweet235 commented Mar 2, 2024

insert a zero width space after each character

This does not seem to work. I tried this:

#: ui/help_gameplay.rml:57
msgid ""
"Building a structure requires build points. Your team will start with a "
"small pool of build points but if you want to place a greater number of "
"buildables in an area, you can build a [leech] mining structure to increase "
"the available power and provide more build points. Be wary that you will "
"loose the build points if the mining structures are destroyed."
msgstr "建​造​设​施​需​要​建​筑​点​。​你​的​阵​营​开​局​有​一​些​建​筑​点​,​不​过​若​你​需​要​新​建​很​多​设​施​,​可​以​先​建​造​ [leech] 采​掘​设​施​,​增​加​供​能​、​获​得​更​多​建​筑​点​。​请​留​意​,​在​采​掘​设​备​被​摧​毁​后​,​建​筑​点​会​丢​失​。"

@sweet235
Copy link
Contributor

sweet235 commented Mar 2, 2024

This is certainly doable without any ugly insertions of break characters:

a

I did this, directly in help_gameplay.rml:

<p style="white-space: pre-line; word-break: break-all">建造设施需要建筑点。你的阵营开局有一些建筑点,不过若你需要新建很多设施,可以先建造 [leech] 采掘设施,增加供能、获得更多建筑点。请留意,在采掘设备被摧毁后,建筑点会丢失。</p>

(Ignore the [leech], this is just me being lazy)

@slipher
Copy link
Contributor

slipher commented Mar 8, 2024

I wonder if this is a libharfbuzz thing. Supposedly that's what you need for RTL text and multi-code point emojis

A way to hack it might be adding extra logic in the translate element

@slipher slipher added A-UI T-Bug A-Translation Anything touching translation problems. Tightly coupled with A-UI labels Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Translation Anything touching translation problems. Tightly coupled with A-UI A-UI T-Bug
Projects
None yet
Development

No branches or pull requests

4 participants