Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: packages/charted/lib/core/text_metrics/segmentation.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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, 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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;
}
}
« no previous file with comments | « packages/charted/lib/core/text_metrics.dart ('k') | packages/charted/lib/core/text_metrics/segmentation_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698