summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/jni/android/graphics/TextLayoutCache.cpp15
-rw-r--r--tests/BiDiTests/res/values/strings.xml1
-rw-r--r--tests/BiDiTests/src/com/android/bidi/BiDiTestView.java6
3 files changed, 19 insertions, 3 deletions
diff --git a/core/jni/android/graphics/TextLayoutCache.cpp b/core/jni/android/graphics/TextLayoutCache.cpp
index 75251c9..b8aaffe 100644
--- a/core/jni/android/graphics/TextLayoutCache.cpp
+++ b/core/jni/android/graphics/TextLayoutCache.cpp
@@ -659,6 +659,13 @@ void TextLayoutEngine::computeRunValues(SkPaint* paint, const UChar* chars,
continue;
}
+#if DEBUG_GLYPHS
+ ALOGD("Returned logclusters");
+ for (size_t i = 0; i < mShaperItem.num_glyphs; i++) {
+ ALOGD(" -- lc[%d] = %d, hb-adv[%d] = %0.2f", i, mShaperItem.log_clusters[i],
+ i, HBFixedToFloat(mShaperItem.advances[i]));
+ }
+#endif
// Get Advances and their total
jfloat currentAdvance = HBFixedToFloat(mShaperItem.advances[mShaperItem.log_clusters[0]]);
jfloat totalFontRunAdvance = currentAdvance;
@@ -670,11 +677,14 @@ void TextLayoutEngine::computeRunValues(SkPaint* paint, const UChar* chars,
outAdvances->add(0);
} else {
currentAdvance = HBFixedToFloat(mShaperItem.advances[mShaperItem.log_clusters[i]]);
- totalFontRunAdvance += currentAdvance;
outAdvances->add(currentAdvance);
}
}
-
+ // TODO: can be removed and go back in the previous loop when Harfbuzz log clusters are fixed
+ for (size_t i = 1; i < mShaperItem.num_glyphs; i++) {
+ currentAdvance = HBFixedToFloat(mShaperItem.advances[i]);
+ totalFontRunAdvance += currentAdvance;
+ }
totalAdvance += totalFontRunAdvance;
#if DEBUG_ADVANCES
@@ -684,7 +694,6 @@ void TextLayoutEngine::computeRunValues(SkPaint* paint, const UChar* chars,
(*outAdvances)[i], mShaperItem.log_clusters[i], totalFontRunAdvance);
}
#endif
-
// Get Glyphs and reverse them in place if RTL
if (outGlyphs) {
size_t countGlyphs = mShaperItem.num_glyphs;
diff --git a/tests/BiDiTests/res/values/strings.xml b/tests/BiDiTests/res/values/strings.xml
index b1f5e50..1d4fc84 100644
--- a/tests/BiDiTests/res/values/strings.xml
+++ b/tests/BiDiTests/res/values/strings.xml
@@ -50,5 +50,6 @@
<string name="rtl">"والحق أن تترك ونص"</string>
<string name="composing">"\u0644\u0627"</string>
<string name="url">www.amazon.co.uk/gp/aw/h.html/275-8912818-8203452</string>
+ <string name="pointer_location" msgid="6084434787496938001">"ตำแหน่งของตัวชี้"</string>
</resources>
diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java
index 0126dea..0b1974a 100644
--- a/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java
+++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestView.java
@@ -51,6 +51,7 @@ public class BiDiTestView extends View {
private String MIXED_TEXT_1;
private String HEBREW_TEXT;
private String RTL_TEXT;
+ private String THAI_TEXT;
private int currentTextSize;
@@ -82,6 +83,7 @@ public class BiDiTestView extends View {
MIXED_TEXT_1 = context.getString(R.string.mixed_text_1);
HEBREW_TEXT = context.getString(R.string.hebrew_text);
RTL_TEXT = context.getString(R.string.rtl);
+ THAI_TEXT = context.getString(R.string.pointer_location);
}
public void setCurrentTextSize(int size) {
@@ -134,6 +136,10 @@ public class BiDiTestView extends View {
// Test Hebrew
deltaX = testString(canvas, RTL_TEXT, ORIGIN, ORIGIN + 14 * currentTextSize,
false, false, Paint.DIRECTION_RTL, currentTextSize);
+
+ // Test Thai
+ deltaX = testString(canvas, THAI_TEXT, ORIGIN, ORIGIN + 16 * currentTextSize,
+ false, false, Paint.DIRECTION_LTR, currentTextSize);
}
private int testString(Canvas canvas, String text, int x, int y,