Skip to content

Commit 8f0bb4b

Browse files
Fabrice Di MeglioAndroid (Google) Code Review
authored andcommitted
Merge "Fix bug # 5376028 Arabic text is kinda broken - disappearing glyphs"
2 parents 25438e2 + 5293cea commit 8f0bb4b

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

core/jni/android/graphics/TextLayoutCache.cpp

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,7 @@ void TextLayoutCacheValue::computeRunValuesWithHarfbuzz(SkPaint* paint, const UC
551551
// Get LogClusters
552552
if (outLogClusters) {
553553
size_t countLogClusters = outLogClusters->size();
554-
size_t countGlyphs = shaperItem.num_glyphs;
555-
for (size_t i = 0; i < countGlyphs; i++) {
554+
for (size_t i = 0; i < count; i++) {
556555
// As there may be successive runs, we need to shift the log clusters
557556
unsigned short logCluster = shaperItem.log_clusters[i] + countLogClusters;
558557
#if DEBUG_GLYPHS
@@ -620,25 +619,15 @@ void TextLayoutCacheValue::getGlyphsIndexAndCount(size_t start, size_t count, si
620619
*outGlyphsCount = 0;
621620
return;
622621
}
623-
size_t endIndex = 0;
624-
for(size_t i = 0; i < mGlyphs.size(); i++) {
625-
if (mLogClusters[i] <= start) {
626-
*outStartIndex = i;
627-
endIndex = i;
628-
continue;
629-
}
630-
if (mLogClusters[i] <= start + count) {
631-
endIndex = i;
632-
}
633-
}
634-
*outGlyphsCount = endIndex - *outStartIndex + 1;
622+
*outStartIndex = mLogClusters[start];
623+
*outGlyphsCount = mLogClusters[start + count - 1] - mLogClusters[start] + 1;
635624
#if DEBUG_GLYPHS
636625
LOGD("getGlyphsIndexes - start=%d count=%d - startIndex=%d count=%d", start, count,
637626
*outStartIndex, *outGlyphsCount);
638627
for(size_t i = 0; i < mGlyphs.size(); i++) {
639628
LOGD("getGlyphs - all - glyph[%d] = %d", i, mGlyphs[i]);
640629
}
641-
for(size_t i = 0; i < mGlyphs.size(); i++) {
630+
for(size_t i = 0; i < mAdvances.size(); i++) {
642631
LOGD("getGlyphs - all - logcl[%d] = %d", i, mLogClusters[i]);
643632
}
644633
#endif

0 commit comments

Comments
 (0)