Fix SkShaper_harfbuzz bidi and non-bmp.
The mismatch between utf8, 16, and 32 and ubudi always wanting to think
in terms of utf16 causes unhappiness.
Change-Id: I375aa61810e344f3b92cba4780c2262d9a878272
Reviewed-on: https://skia-review.googlesource.com/99922
Reviewed-by: Ben Wagner <bungeman@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
diff --git a/tools/shape/SkShaper_harfbuzz.cpp b/tools/shape/SkShaper_harfbuzz.cpp
index 6315a96..c5f437e 100644
--- a/tools/shape/SkShaper_harfbuzz.cpp
+++ b/tools/shape/SkShaper_harfbuzz.cpp
@@ -134,16 +134,16 @@
SkASSERT(fUTF16LogicalPosition < ubidi_getLength(fBidi.get()));
int32_t endPosition = ubidi_getLength(fBidi.get());
fLevel = ubidi_getLevelAt(fBidi.get(), fUTF16LogicalPosition);
- ++fUTF16LogicalPosition;
- SkUTF8_NextUnichar(&fEndOfCurrentRun);
+ SkUnichar u = SkUTF8_NextUnichar(&fEndOfCurrentRun);
+ fUTF16LogicalPosition += SkUTF16_FromUnichar(u);
UBiDiLevel level;
while (fUTF16LogicalPosition < endPosition) {
level = ubidi_getLevelAt(fBidi.get(), fUTF16LogicalPosition);
if (level != fLevel) {
break;
}
- ++fUTF16LogicalPosition;
- SkUTF8_NextUnichar(&fEndOfCurrentRun);
+ u = SkUTF8_NextUnichar(&fEndOfCurrentRun);
+ fUTF16LogicalPosition += SkUTF16_FromUnichar(u);
}
}
const char* endOfCurrentRun() const override {