mongol icon indicating copy to clipboard operation
mongol copied to clipboard

The Arabic numerals cannot be wrapped correctly.

Open iceXice opened this issue 1 year ago • 2 comments

ver 8.0.0

截屏2024-10-14 11 28 12

iceXice avatar Oct 14 '24 03:10 iceXice

截屏2024-10-14 14 34 03

const text2 = TextSpan( children: [ TextSpan(text: '1234567890'), TextSpan(text: '👨‍👩‍👧'), TextSpan(text: '👋🏿'), TextSpan(text: '🇭🇺'), TextSpan(text: '一二三四五六七八九十'), TextSpan( text: '\uD83D\uDE03\uD83D\uDE0A\uD83D\uDE1C\uD83D\uDE01\uD83D\uDE2C\uD83D\uDE2E\uD83D\uDC34\uD83D\uDC02\uD83D\uDC2B\uD83D\uDC11\uD83D\uDC10'), TextSpan(text: '①②③㉑㊿〖汉字〗한국어モンゴル語English? ︽ᠮᠣᠩᠭᠣᠯ︖︾'), ], );

iceXice avatar Oct 14 '24 06:10 iceXice

This is a problem with the line-breaking. Flutter doesn't give access to a good line-breaker so the current solution in this package just breaks lines on single emojis, CJK characters, newlines, and spaces. The implementation is here:

https://github.com/suragch/mongol/blob/master/lib/src/base/mongol_paragraph.dart#L1108

To solve this, we would need a more sophisticated algorithm that breaks long words (both English and Mongolian) and numbers across lines. Ideally it would prefer breaking at certain characters such as /, -, etc.

See also:

  • https://github.com/flutter/flutter/issues/50171
  • https://github.com/flutter/flutter/issues/53549
  • http://www.unicode.org/reports/tr14/

suragch avatar Oct 14 '24 07:10 suragch