[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/include/SkSVGText.h b/modules/svg/include/SkSVGText.h
index 1f45fd3..c446a21 100644
--- a/modules/svg/include/SkSVGText.h
+++ b/modules/svg/include/SkSVGText.h
@@ -23,8 +23,7 @@
protected:
explicit SkSVGTextFragment(SkSVGTag t) : INHERITED(t) {}
- virtual void onRenderText(const SkSVGRenderContext&, SkSVGTextContext*,
- SkSVGXmlSpace) const = 0;
+ virtual void onShapeText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const = 0;
// Text nodes other than the root <text> element are not rendered directly.
void onRender(const SkSVGRenderContext&) const override {}
@@ -51,7 +50,7 @@
protected:
explicit SkSVGTextContainer(SkSVGTag t) : INHERITED(t) {}
- void onRenderText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override;
+ void onShapeText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override;
bool parseAndSetAttribute(const char*, const char*) override;
@@ -94,7 +93,7 @@
private:
SkSVGTextLiteral() : INHERITED(SkSVGTag::kTextLiteral) {}
- void onRenderText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override;
+ void onShapeText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override;
void appendChild(sk_sp<SkSVGNode>) override {}
@@ -111,7 +110,7 @@
private:
SkSVGTextPath() : INHERITED(SkSVGTag::kTextPath) {}
- void onRenderText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override;
+ void onShapeText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override;
bool parseAndSetAttribute(const char*, const char*) override;
using INHERITED = SkSVGTextContainer;