tangram icon indicating copy to clipboard operation
tangram copied to clipboard

When the text is Chinese, the text_wrap parameter does not work.

Open ligai322 opened this issue 9 years ago • 3 comments
trafficstars

for example: I come from Beijing. But This sentence write in Chinese, like '我来自北京'. I have already submitted the question in tangram-es.Text line breaks The tangram has the same problem.

ligai322 avatar Nov 10 '16 01:11 ligai322

Would be great to get this fixed for next release.

bcamper avatar Dec 05 '16 22:12 bcamper

This is a little more complicated on the JS side because we can't lean on another library to tell us if we can break on a character in a word.

In English, for example, a long word that overflows the word-wrap value would need to break on a random character (if we don't do something clever, such as hyphenate, which is probably only more complicated). This would be bad, but for Chinese, breaking on most characters are fine (as far as I understand).

Leaving this link from the ES PR for reference here: https://en.wikipedia.org/wiki/Line_breaking_rules_in_East_Asian_languages

dmvaldman avatar Dec 05 '16 22:12 dmvaldman

Though apparently there is a TC39 proposal to bring this to JS https://github.com/tc39/proposal-intl-segmenter

dmvaldman avatar Dec 06 '16 16:12 dmvaldman