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

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

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 months 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
« no previous file with comments | « charted/lib/core/text_metrics.dart ('k') | charted/lib/core/text_metrics/segmentation_data.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: charted/lib/core/text_metrics/segmentation.dart
diff --git a/charted/lib/core/text_metrics/segmentation.dart b/charted/lib/core/text_metrics/segmentation.dart
deleted file mode 100644
index b1c6c3115fb82f3fc676a757aec7394cf6746e40..0000000000000000000000000000000000000000
--- a/charted/lib/core/text_metrics/segmentation.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-//
-// Copyright 2014 Google Inc. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file or at
-// https://developers.google.com/open-source/licenses/bsd
-//
-
-library charted.core.text_metrics.segmentation;
-
-import "package:charted/core/text_metrics/segmentation_utils.dart";
-import "package:charted/core/text_metrics/segmentation_data.dart";
-
-/// Current unicode version.
-/// Character database available at http://www.unicode.org/Public/7.0.0/ucd/
-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
-];
-
-/// Get type of a given char code.
-int _typeForRune(int rune) {
- int count = CODE_POINT_BLOCKS.length ~/ 3;
- int min = 0;
- int max = count - 1;
- 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) {
- max = mid - 1;
- }
- else if (CODE_POINT_BLOCKS[idx+1] < rune) {
- min = max + 1;
- }
- }
- return CODE_CATEGORY_OTHER; // Defaults to OTHER.
-}
-
-Iterable<int> graphemeBreakIndices(String s) {
- List<int> indices = [];
- int previousType = 0;
- for (var iter = s.runes.iterator; iter.moveNext();) {
- int currentType = _typeForRune(iter.current);
- if (GRAPHEME_BREAK_TABLE[previousType * 12 + currentType] == 1) {
- indices.add(iter.rawIndex);
- }
- previousType = currentType;
- }
- return indices;
-}
« no previous file with comments | « charted/lib/core/text_metrics.dart ('k') | charted/lib/core/text_metrics/segmentation_data.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698