We’ve just started using Rich Text for a couple of popups, via Druid. All works fine for western/Roman fonts but, for Japanese, Chinese, Korean we rely on our text having zero width spaces between each character so Defold can put line breaks into text. With the Rich Text, this doesn’t seem to work.
Is there a setting somewhere I need to set to make the rich text boxes line break on a zero width space?
Please could you elaborate on what you mean by post processing step? When would I insert these spaces?
I tried digging into the rich text library which seems to split the text into words to work out their length from text metrics, and made it split into words based on zero width spaces as well as normal spaces, but the rich text library then seems to clone a new gui object for each word, which results in huge numbers being created for Japanese etc, which overflowed the number of gui elements I can create (even if I greatly increase the buffer).
Post processing step - any step before this locales going to build (it can be editor scripts hook or special dedicated step when you work with localizations)
This approach good when working with regular labels/texts, but you right about Rich Text - it will create a text node for each word. If this is not suitable (I think even a 500 nodes will be okay for some cases, if this a dedicated dialog window for example), probably you have two options
One is to manually place this zero-width spaces in JP locales to mark a new lines places
Second is somehow to implement in code side. Probably you can add this spaces like each 4-5 symbols or think about other solution.
Thanks - I already have the zero width spaces in my JP text (I pre-process these in my text exporter), the problem is that the rich text doesn’t seem to want to break there, whereas the non-rich text items do. I think maybe my best option for now is just to avoid using rich text when I’m likely to want more than a few words of JP/CN/KO text.
I like your idea of only inserting the space every 4-5 characters, that might solve it if the rich text box will break on a zero width space, which it doesn’t seem to at the moment.