skia2/modules/svg/include/SkSVGText.h
Florin Malita 056385b1c6 [svg] Convert text-anchor to a presentation attribute
https://www.w3.org/TR/SVG11/text.html#TextAnchorProperty

Bug: skia:10840
Change-Id: Iff647b62243c42150e873f06215401b5e33705fd
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/330125
Commit-Queue: Florin Malita <fmalita@google.com>
Reviewed-by: Tyler Denniston <tdenniston@google.com>
2020-10-28 14:10:01 +00:00

46 lines
1.1 KiB
C++

/*
* 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"
#include "modules/svg/include/SkSVGTransformableNode.h"
#include "modules/svg/include/SkSVGTypes.h"
class SkRRect;
class SkSVGText final : public SkSVGTransformableNode {
public:
~SkSVGText() override = default;
static sk_sp<SkSVGText> Make() {
return sk_sp<SkSVGText>(new SkSVGText()); }
SVG_ATTR(X , SkSVGLength , SkSVGLength(0))
SVG_ATTR(Y , SkSVGLength , SkSVGLength(0))
SVG_ATTR(Text, SkSVGStringType, SkSVGStringType())
protected:
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
void onRender(const SkSVGRenderContext&) const override;
void appendChild(sk_sp<SkSVGNode>) override;
SkPath onAsPath(const SkSVGRenderContext&) const override;
void loadFont();
private:
SkSVGText();
SkFont resolveFont(const SkSVGRenderContext&) const;
using INHERITED = SkSVGTransformableNode;
};
#endif // SkSVGText_DEFINED