Hack up SkShaper to pass additional callback info
- rename LineHandler -> RunHandler (since it gets called per run)
- pass additionl run info:
* line index
* cumulative advance
* ascent/descent/leading
Bug: skia:
Change-Id: Ie848e5a35243088b99989c73fdec44c6a1bdd051
Reviewed-on: https://skia-review.googlesource.com/c/183300
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
diff --git a/modules/skshaper/src/SkShaper_primitive.cpp b/modules/skshaper/src/SkShaper_primitive.cpp
index 3d54262..f00db9f 100644
--- a/modules/skshaper/src/SkShaper_primitive.cpp
+++ b/modules/skshaper/src/SkShaper_primitive.cpp
@@ -31,7 +31,7 @@
return (((0xE5 << 24) >> ((unsigned)c >> 4 << 1)) & 3) + 1;
}
-SkPoint SkShaper::shape(LineHandler* handler,
+SkPoint SkShaper::shape(RunHandler* handler,
const SkFont& srcFont,
const char* utf8text,
size_t textBytes,
@@ -52,7 +52,14 @@
font.getMetrics(&metrics);
point.fY -= metrics.fAscent;
- const auto buffer = handler->newLineBuffer(font, glyphCount, textBytes);
+ const RunHandler::RunInfo info = {
+ 0,
+ { font.measureText(utf8text, textBytes, SkTextEncoding::kUTF8), 0 },
+ metrics.fAscent,
+ metrics.fDescent,
+ metrics.fLeading,
+ };
+ const auto buffer = handler->newRunBuffer(info, font, glyphCount, textBytes);
SkAssertResult(font.textToGlyphs(utf8text, textBytes, SkTextEncoding::kUTF8, buffer.glyphs,
glyphCount) == glyphCount);
font.getPos(buffer.glyphs, glyphCount, buffer.positions, point);