MCPcopy Create free account
hub / github.com/antvis/F2Native / Text

Method Text

core/graphics/shape/Text.cpp:4–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <utils/StringUtil.h>
3
4xg::shape::Text::Text(const std::string &text, const Point &pt, const float fontSize, const std::string &strokeColor, const std::string &fillColor) {
5 type_ = "text";
6 lineWidth_ = std::nan("0");
7 point_ = pt;
8 fontSize_ = fontSize;
9
10 if(!fillColor.empty()) {
11 fillStyle_ = canvas::CanvasFillStrokeStyle(fillColor);
12 }
13 if(!strokeColor.empty()) {
14 strokeStyle_ = canvas::CanvasFillStrokeStyle(strokeColor);
15 }
16
17 font_ = GetFontStyle();
18 text_ = text;
19 lineCount_ = 1;
20 if(text.size() && text.find("\n") != string::npos) {
21 StringUtil::Split(text, textArr_, '\n');
22 lineCount_ = (int)textArr_.size();
23 }
24}
25
26void xg::shape::Text::DrawInner(canvas::CanvasContext &context) const {
27 if(std::isnan(point_.x) || std::isnan(point_.y)) {

Callers 1

SetChartGuideTypeFunction · 0.45

Calls 4

findMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected