summaryrefslogtreecommitdiff
path: root/core/java/android/text/Layout.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/text/Layout.java')
-rw-r--r--core/java/android/text/Layout.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/core/java/android/text/Layout.java b/core/java/android/text/Layout.java
index e5fd2921227d..c8e0dd291041 100644
--- a/core/java/android/text/Layout.java
+++ b/core/java/android/text/Layout.java
@@ -2360,6 +2360,52 @@ public abstract class Layout {
public Directions(int[] dirs) {
mDirections = dirs;
}
+
+ /**
+ * Returns number of BiDi runs.
+ *
+ * @hide
+ */
+ public @IntRange(from = 0) int getRunCount() {
+ return mDirections.length / 2;
+ }
+
+ /**
+ * Returns the start offset of the BiDi run.
+ *
+ * @param runIndex the index of the BiDi run
+ * @return the start offset of the BiDi run.
+ * @hide
+ */
+ public @IntRange(from = 0) int getRunStart(@IntRange(from = 0) int runIndex) {
+ return mDirections[runIndex * 2];
+ }
+
+ /**
+ * Returns the length of the BiDi run.
+ *
+ * Note that this method may return too large number due to reducing the number of object
+ * allocations. The too large number means the remaining part is assigned to this run. The
+ * caller must clamp the returned value.
+ *
+ * @param runIndex the index of the BiDi run
+ * @return the length of the BiDi run.
+ * @hide
+ */
+ public @IntRange(from = 0) int getRunLength(@IntRange(from = 0) int runIndex) {
+ return mDirections[runIndex * 2 + 1] & RUN_LENGTH_MASK;
+ }
+
+ /**
+ * Returns true if the BiDi run is RTL.
+ *
+ * @param runIndex the index of the BiDi run
+ * @return true if the BiDi run is RTL.
+ * @hide
+ */
+ public boolean isRunRtl(int runIndex) {
+ return (mDirections[runIndex * 2 + 1] & RUN_RTL_FLAG) != 0;
+ }
}
/**