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

Method GetTextHeightWithContext

core/graphics/shape/Text.cpp:115–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115float xg::shape::Text::GetTextHeightWithContext(canvas::CanvasContext &context) const {
116 if(!std::isnan(height_)) {
117 return height_;
118 }
119
120 context.SetFont(font_);
121 if(textArr_.size()) {
122 float maxWidth = 0;
123 for_each(textArr_.begin(), textArr_.end(),
124 [&maxWidth, &context](const std::string &t) { maxWidth = std::max(maxWidth, context.MeasureTextHeight(t)); });
125 return maxWidth;
126 } else {
127 return context.MeasureTextHeight(text_);
128 }
129}
130
131void xg::shape::Text::AdaptTextFontSize(canvas::CanvasContext &context,
132 int padding, int minSize, int maxWidth) {

Callers

nothing calls this directly

Calls 5

beginMethod · 0.80
endMethod · 0.80
MeasureTextHeightMethod · 0.80
SetFontMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected