Japanese text line breaks


What to do about text that’s all on one line technically?

Here’s a machine translated sample

Do we need to manually apply line breaks in cases like these either in the text itself or code so that the linebreakless text fits better within text nodes or is there an option I’m not thinking of?

1 Like


There is an old issue to correctly handle line breaks in Asian (and other) languages; DEF-1509

However, there is support for zero-width space character that you could include in your strings. (Granted not the best solution though…)

In Lua, I think you could do something like this (I haven’t tried it myself):

local zws = "\xe2\x80\x8b"
local a = "モグは厚いかみそりの" .. zws .. "鋭いシダを突き破った。"


The “zero-width space” character “\xe2\x80\x8b” does actually produce spaces. This should probably be fixed to not happen by engine.


If I add some negative text tracking it does look better


Here is example project

UTF8JapaneseText.zip (2.1 MB)

This could probably be made smarter by detecting non-Japanese chars and not adding zero-width space char after them so they don’t split in half when mixed in but then that would mess up the tracking.

There are also some special situations to consider https://www.w3.org/TR/2009/NOTE-jlreq-20090604/#en-subheading2_1_7



We do nothing special with the zero-width space character except use it when calculating linebreaks. If the zero-width space character has some width it is probably because it’s like that in the font.



Opened font in FontForge


U+200B https://www.utf8-chartable.de/unicode-utf8-table.pl?start=8192&number=128&utf8=string-literal

Width was at 512

Set to 0

Set leading back to 0 on the text node





So should be possible to detect English words and not add zero width spaces within them. There are still more considerations until this is really good too.

1 Like