summaryrefslogtreecommitdiff
path: root/core/java/android/text/TextLine.java
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2013-03-15 11:26:56 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2013-03-15 11:26:56 -0700
commitda12f389eb4be0c08ca3fa9ca7663f4977858df5 (patch)
treeb1bf0853765bb1bb4728073b8f08982131d1cc04 /core/java/android/text/TextLine.java
parent19f46b0d7a1cdba362bc3d6fc8e9251307e96bd4 (diff)
Revert "Clean Paint.mBidiFlags as it is no longer used"
This reverts commit 6d9fe5bd22b531bfce69b146254a4791c76acddc.
Diffstat (limited to 'core/java/android/text/TextLine.java')
-rw-r--r--core/java/android/text/TextLine.java24
1 files changed, 15 insertions, 9 deletions
diff --git a/core/java/android/text/TextLine.java b/core/java/android/text/TextLine.java
index e34a0efccf21..1fecf81d5a4f 100644
--- a/core/java/android/text/TextLine.java
+++ b/core/java/android/text/TextLine.java
@@ -664,13 +664,14 @@ class TextLine {
}
}
+ int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;
int cursorOpt = after ? Paint.CURSOR_AFTER : Paint.CURSOR_BEFORE;
if (mCharsValid) {
return wp.getTextRunCursor(mChars, spanStart, spanLimit - spanStart,
- offset, cursorOpt);
+ flags, offset, cursorOpt);
} else {
return wp.getTextRunCursor(mText, mStart + spanStart,
- mStart + spanLimit, mStart + offset, cursorOpt) - mStart;
+ mStart + spanLimit, flags, mStart + offset, cursorOpt) - mStart;
}
}
@@ -737,13 +738,15 @@ class TextLine {
int contextLen = contextEnd - contextStart;
if (needWidth || (c != null && (wp.bgColor != 0 || wp.underlineColor != 0 || runIsRtl))) {
+ int flags = runIsRtl ? Paint.DIRECTION_RTL : Paint.DIRECTION_LTR;
if (mCharsValid) {
ret = wp.getTextRunAdvances(mChars, start, runLen,
- contextStart, contextLen, null, 0);
+ contextStart, contextLen, flags, null, 0);
} else {
int delta = mStart;
- ret = wp.getTextRunAdvances(mText, delta + start, delta + end,
- delta + contextStart, delta + contextEnd, null, 0);
+ ret = wp.getTextRunAdvances(mText, delta + start,
+ delta + end, delta + contextStart, delta + contextEnd,
+ flags, null, 0);
}
}
@@ -783,7 +786,8 @@ class TextLine {
wp.setAntiAlias(previousAntiAlias);
}
- drawTextRun(c, wp, start, end, contextStart, contextEnd, x, y + wp.baselineShift);
+ drawTextRun(c, wp, start, end, contextStart, contextEnd, runIsRtl,
+ x, y + wp.baselineShift);
}
return runIsRtl ? -ret : ret;
@@ -966,21 +970,23 @@ class TextLine {
* @param end the end of the run
* @param contextStart the start of context for the run
* @param contextEnd the end of the context for the run
+ * @param runIsRtl true if the run is right-to-left
* @param x the x position of the left edge of the run
* @param y the baseline of the run
*/
private void drawTextRun(Canvas c, TextPaint wp, int start, int end,
- int contextStart, int contextEnd, float x, int y) {
+ int contextStart, int contextEnd, boolean runIsRtl, float x, int y) {
+ int flags = runIsRtl ? Canvas.DIRECTION_RTL : Canvas.DIRECTION_LTR;
if (mCharsValid) {
int count = end - start;
int contextCount = contextEnd - contextStart;
c.drawTextRun(mChars, start, count, contextStart, contextCount,
- x, y, wp);
+ x, y, flags, wp);
} else {
int delta = mStart;
c.drawTextRun(mText, delta + start, delta + end,
- delta + contextStart, delta + contextEnd, x, y, wp);
+ delta + contextStart, delta + contextEnd, x, y, flags, wp);
}
}