| 255 | } |
| 256 | |
| 257 | Size2 Font::get_string_size(const String& p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const |
| 258 | { |
| 259 | bool fill = (p_alignment == HORIZONTAL_ALIGNMENT_FILL); |
| 260 | ShapedTextKey key = ShapedTextKey(p_text, p_font_size, fill ? p_width : 0.0f, fill ? p_jst_flags : TextServer::JUSTIFICATION_NONE, TextServer::BREAK_NONE, p_direction, p_orientation); |
| 261 | |
| 262 | Ref<TextLine> buffer; |
| 263 | auto&& iter = cache.find(key); |
| 264 | if (cache.contains(key)) |
| 265 | { |
| 266 | buffer = cache.lookup(key); |
| 267 | } |
| 268 | else |
| 269 | { |
| 270 | buffer.instantiate(); |
| 271 | buffer->set_direction(p_direction); |
| 272 | buffer->set_orientation(p_orientation); |
| 273 | buffer->add_string(p_text, Ref<Font>(const_cast<Font*>(this)), p_font_size); |
| 274 | cache.insert(key, buffer); |
| 275 | } |
| 276 | |
| 277 | buffer->set_width(p_width); |
| 278 | buffer->set_horizontal_alignment(p_alignment); |
| 279 | if (p_alignment == HORIZONTAL_ALIGNMENT_FILL) |
| 280 | { |
| 281 | buffer->set_flags(p_jst_flags); |
| 282 | } |
| 283 | |
| 284 | return buffer->get_size(); |
| 285 | } |
| 286 | |
| 287 | Size2 Font::get_multiline_string_size(const String& p_text, HorizontalAlignment p_alignment, float p_width, int p_font_size, int p_max_lines, BitField<TextServer::LineBreakFlag> p_brk_flags, BitField<TextServer::JustificationFlag> p_jst_flags, TextServer::Direction p_direction, TextServer::Orientation p_orientation) const |
| 288 | { |
nothing calls this directly
no test coverage detected