[svg] Generalize text shaping
In preparation for text bounding box support, fission the actual
rendering phase from the shaping/alignment phase:
- rename onRenderText -> onShapeText
- introduce a ShapedTextCallback abstraction for consuming the result
of text processing
- relocate the final rendering step to a ShapedTextCallback impl
Bug: skia:10840
Change-Id: Ia8cc0d9a5a5484972a34042fd782f9e4fada6b12
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/358223
Commit-Queue: Florin Malita <fmalita@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
diff --git a/modules/svg/tests/Text.cpp b/modules/svg/tests/Text.cpp
index 83feda4..107395b 100644
--- a/modules/svg/tests/Text.cpp
+++ b/modules/svg/tests/Text.cpp
@@ -144,6 +144,9 @@
},
};
+ const SkSVGTextContext::ShapedTextCallback mock_cb =
+ [](const SkSVGRenderContext&, const sk_sp<SkTextBlob>&, const SkPaint*, const SkPaint*) {};
+
auto test = [&](const PosTestDesc& tst) {
auto a = SkSVGText::Make();
auto b = SkSVGTSpan::Make();
@@ -161,7 +164,7 @@
sk_sp<SkFontMgr> fmgr;
const SkSVGRenderContext ctx(&canvas, fmgr, mapper, lctx, pctx, nullptr);
- SkSVGTextContext tctx(ctx);
+ SkSVGTextContext tctx(ctx, mock_cb);
SkSVGTextContext::ScopedPosResolver pa(*a, lctx, &tctx, tst.offseta);
SkSVGTextContext::ScopedPosResolver pb(*b, lctx, &tctx, tst.offsetb);