| 97 | } |
| 98 | |
| 99 | float xg::shape::Text::GetTextWidth(canvas::CanvasContext &context) const { |
| 100 | if(!std::isnan(width_)) { |
| 101 | return width_; |
| 102 | } |
| 103 | |
| 104 | context.SetFont(font_); |
| 105 | if(textArr_.size()) { |
| 106 | float maxWidth = 0; |
| 107 | for_each(textArr_.begin(), textArr_.end(), |
| 108 | [&maxWidth, &context](const std::string &t) { maxWidth = std::max(maxWidth, context.MeasureTextWidth(t)); }); |
| 109 | return maxWidth; |
| 110 | } else { |
| 111 | return context.MeasureTextWidth(text_); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | float xg::shape::Text::GetTextHeightWithContext(canvas::CanvasContext &context) const { |
| 116 | if(!std::isnan(height_)) { |
no test coverage detected