| Index: packages/charted/lib/core/text_metrics/segmentation.dart
|
| diff --git a/packages/charted/lib/core/text_metrics/segmentation.dart b/packages/charted/lib/core/text_metrics/segmentation.dart
|
| index b1c6c3115fb82f3fc676a757aec7394cf6746e40..058ac3895d5c5734f0023507702b27b987cf6daf 100644
|
| --- a/packages/charted/lib/core/text_metrics/segmentation.dart
|
| +++ b/packages/charted/lib/core/text_metrics/segmentation.dart
|
| @@ -18,19 +18,151 @@ const UNICODE_VERSION = '7.0.0';
|
| // Code table based on:
|
| // http://www.unicode.org/Public/7.0.0/ucd/auxiliary/GraphemeBreakTest.html
|
| // GRAPHEME_BREAK_TABLE[prevType * TYPE_COUNT + curType] == 1 means break.
|
| -const GRAPHEME_BREAK_TABLE = const[
|
| - 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,
|
| - 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
| - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
| - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
| - 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,
|
| - 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1,
|
| - 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1,
|
| - 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1,
|
| - 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1,
|
| - 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1,
|
| - 1, 1, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1,
|
| - 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0
|
| +const GRAPHEME_BREAK_TABLE = const [
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 1,
|
| + 0
|
| ];
|
|
|
| /// Get type of a given char code.
|
| @@ -41,13 +173,12 @@ int _typeForRune(int rune) {
|
| while (max >= min) {
|
| int mid = (max + min) ~/ 2;
|
| int idx = mid * 3;
|
| - if (CODE_POINT_BLOCKS[idx] <= rune && rune <= CODE_POINT_BLOCKS[idx+1]) {
|
| - return CODE_POINT_BLOCKS[idx+2]; // Return the found character type
|
| + if (CODE_POINT_BLOCKS[idx] <= rune && rune <= CODE_POINT_BLOCKS[idx + 1]) {
|
| + return CODE_POINT_BLOCKS[idx + 2]; // Return the found character type
|
| }
|
| if (CODE_POINT_BLOCKS[idx] > rune) {
|
| max = mid - 1;
|
| - }
|
| - else if (CODE_POINT_BLOCKS[idx+1] < rune) {
|
| + } else if (CODE_POINT_BLOCKS[idx + 1] < rune) {
|
| min = max + 1;
|
| }
|
| }
|
|
|