diff options
| author | Fabrice Di Meglio <fdimeglio@google.com> | 2011-09-06 15:12:25 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-06 15:12:25 -0700 |
| commit | c6fc20a91bdf6f5d8cd8784324a55e39bcb7077c (patch) | |
| tree | cab9acf18171ad65b20f4fcc2f39de8f35f2a834 /core/java/android/text/TextDirectionHeuristics.java | |
| parent | fe1aafe4acd881712384fab8e9fb5d0b01232dab (diff) | |
| parent | e3bf88da23bfadd89a35b6dec769ea825e5ecd6e (diff) | |
| download | frameworks_base-c6fc20a91bdf6f5d8cd8784324a55e39bcb7077c.zip frameworks_base-c6fc20a91bdf6f5d8cd8784324a55e39bcb7077c.tar.gz frameworks_base-c6fc20a91bdf6f5d8cd8784324a55e39bcb7077c.tar.bz2 | |
Merge "Fix bug #5262565 Need to remove CharCount TextDirectionHeuristics"
Diffstat (limited to 'core/java/android/text/TextDirectionHeuristics.java')
| -rw-r--r-- | core/java/android/text/TextDirectionHeuristics.java | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/core/java/android/text/TextDirectionHeuristics.java b/core/java/android/text/TextDirectionHeuristics.java index 18b4040..e5c1e5b 100644 --- a/core/java/android/text/TextDirectionHeuristics.java +++ b/core/java/android/text/TextDirectionHeuristics.java @@ -62,24 +62,6 @@ public class TextDirectionHeuristics { new TextDirectionHeuristicInternal(AnyStrong.INSTANCE_RTL, false); /** - * Examines only the strong directional non-format characters, and if either - * left to right or right to left characters are 60% or more of this total, - * determines that the direction follows the majority of characters. Falls - * back to left to right if neither direction meets this threshold. - */ - public static final TextDirectionHeuristic CHARCOUNT_LTR = - new TextDirectionHeuristicInternal(CharCount.INSTANCE_DEFAULT, false); - - /** - * Examines only the strong directional non-format characters, and if either - * left to right or right to left characters are 60% or more of this total, - * determines that the direction follows the majority of characters. Falls - * back to right to left if neither direction meets this threshold. - */ - public static final TextDirectionHeuristic CHARCOUNT_RTL = - new TextDirectionHeuristicInternal(CharCount.INSTANCE_DEFAULT, true); - - /** * Force the paragraph direction to the Locale direction. Falls back to left to right. */ public static final TextDirectionHeuristic LOCALE = TextDirectionHeuristicLocale.INSTANCE; @@ -255,62 +237,6 @@ public class TextDirectionHeuristics { } /** - * Algorithm that uses the relative proportion of strong directional - * characters (excluding LRE, LRO, RLE, RLO) to determine the direction - * of the paragraph, if the proportion exceeds a given threshold. - * - * @hide - */ - public static class CharCount implements TextDirectionAlgorithm { - private final float mThreshold; - - @Override - public TriState checkRtl(char[] text, int start, int count) { - int countLtr = 0; - int countRtl = 0; - for(int i = start, e = start + count; i < e; ++i) { - switch (isRtlText(Character.getDirectionality(text[i]))) { - case TRUE: - ++countLtr; - break; - case FALSE: - ++countRtl; - break; - default: - break; - } - } - int limit = (int)((countLtr + countRtl) * mThreshold); - if (limit > 0) { - if (countLtr > limit) { - return TriState.FALSE; - } - if (countRtl > limit) { - return TriState.TRUE; - } - } - return TriState.UNKNOWN; - } - - private CharCount(float threshold) { - mThreshold = threshold; - } - - public static CharCount withThreshold(float threshold) { - if (threshold < 0 || threshold > 1) { - throw new IllegalArgumentException(); - } - if (threshold == DEFAULT_THRESHOLD) { - return INSTANCE_DEFAULT; - } - return new CharCount(threshold); - } - - public static final float DEFAULT_THRESHOLD = 0.6f; - public static final CharCount INSTANCE_DEFAULT = new CharCount(DEFAULT_THRESHOLD); - } - - /** * Algorithm that uses the Locale direction to force the direction of a paragraph. */ public static class TextDirectionHeuristicLocale extends TextDirectionHeuristicImpl { |
