Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5293cea4 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Fix bug # 5376028 Arabic text is kinda broken - disappearing glyphs

- make the log clusters happy

Change-Id: I73ca9512f0ca02549dad5270d6ec198ae9b00a4e
parent 4c253119
Loading
Loading
Loading
Loading
+4 −15
Original line number Original line Diff line number Diff line
@@ -551,8 +551,7 @@ void TextLayoutCacheValue::computeRunValuesWithHarfbuzz(SkPaint* paint, const UC
    // Get LogClusters
    // Get LogClusters
    if (outLogClusters) {
    if (outLogClusters) {
        size_t countLogClusters = outLogClusters->size();
        size_t countLogClusters = outLogClusters->size();
        size_t countGlyphs = shaperItem.num_glyphs;
        for (size_t i = 0; i < count; i++) {
        for (size_t i = 0; i < countGlyphs; i++) {
            // As there may be successive runs, we need to shift the log clusters
            // As there may be successive runs, we need to shift the log clusters
            unsigned short logCluster = shaperItem.log_clusters[i] + countLogClusters;
            unsigned short logCluster = shaperItem.log_clusters[i] + countLogClusters;
#if DEBUG_GLYPHS
#if DEBUG_GLYPHS
@@ -620,25 +619,15 @@ void TextLayoutCacheValue::getGlyphsIndexAndCount(size_t start, size_t count, si
        *outGlyphsCount = 0;
        *outGlyphsCount = 0;
        return;
        return;
    }
    }
    size_t endIndex = 0;
    *outStartIndex = mLogClusters[start];
    for(size_t i = 0; i < mGlyphs.size(); i++) {
    *outGlyphsCount = mLogClusters[start + count - 1] - mLogClusters[start] + 1;
        if (mLogClusters[i] <= start) {
            *outStartIndex = i;
            endIndex = i;
            continue;
        }
        if (mLogClusters[i] <= start + count) {
            endIndex = i;
        }
    }
    *outGlyphsCount = endIndex - *outStartIndex + 1;
#if DEBUG_GLYPHS
#if DEBUG_GLYPHS
    LOGD("getGlyphsIndexes - start=%d count=%d - startIndex=%d count=%d", start, count,
    LOGD("getGlyphsIndexes - start=%d count=%d - startIndex=%d count=%d", start, count,
            *outStartIndex, *outGlyphsCount);
            *outStartIndex, *outGlyphsCount);
    for(size_t i = 0; i < mGlyphs.size(); i++) {
    for(size_t i = 0; i < mGlyphs.size(); i++) {
        LOGD("getGlyphs - all - glyph[%d] = %d", i, mGlyphs[i]);
        LOGD("getGlyphs - all - glyph[%d] = %d", i, mGlyphs[i]);
    }
    }
    for(size_t i = 0; i < mGlyphs.size(); i++) {
    for(size_t i = 0; i < mAdvances.size(); i++) {
        LOGD("getGlyphs - all - logcl[%d] = %d", i, mLogClusters[i]);
        LOGD("getGlyphs - all - logcl[%d] = %d", i, mLogClusters[i]);
    }
    }
#endif
#endif