2020-10-15 22:10:29 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2019 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkSVGText_DEFINED
|
|
|
|
#define SkSVGText_DEFINED
|
|
|
|
|
|
|
|
#include "include/utils/SkTextUtils.h"
|
2020-10-20 14:43:03 +00:00
|
|
|
#include "modules/svg/include/SkSVGTransformableNode.h"
|
2020-10-15 22:10:29 +00:00
|
|
|
#include "modules/svg/include/SkSVGTypes.h"
|
|
|
|
|
|
|
|
class SkRRect;
|
|
|
|
|
2020-10-20 14:43:03 +00:00
|
|
|
class SkSVGText final : public SkSVGTransformableNode {
|
2020-10-15 22:10:29 +00:00
|
|
|
public:
|
|
|
|
~SkSVGText() override = default;
|
|
|
|
static sk_sp<SkSVGText> Make() {
|
|
|
|
return sk_sp<SkSVGText>(new SkSVGText()); }
|
|
|
|
|
2020-10-28 02:57:56 +00:00
|
|
|
SVG_ATTR(X , SkSVGLength , SkSVGLength(0))
|
|
|
|
SVG_ATTR(Y , SkSVGLength , SkSVGLength(0))
|
|
|
|
SVG_ATTR(Text, SkSVGStringType, SkSVGStringType())
|
2020-10-15 22:10:29 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
|
|
|
|
|
2020-10-20 14:43:03 +00:00
|
|
|
void onRender(const SkSVGRenderContext&) const override;
|
|
|
|
void appendChild(sk_sp<SkSVGNode>) override;
|
2020-10-15 22:10:29 +00:00
|
|
|
|
|
|
|
SkPath onAsPath(const SkSVGRenderContext&) const override;
|
|
|
|
|
|
|
|
void loadFont();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SkSVGText();
|
2020-10-20 14:43:03 +00:00
|
|
|
|
|
|
|
SkFont resolveFont(const SkSVGRenderContext&) const;
|
|
|
|
|
|
|
|
using INHERITED = SkSVGTransformableNode;
|
2020-10-15 22:10:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SkSVGText_DEFINED
|