| 518 | } |
| 519 | |
| 520 | bool Text::hardWrapText( Font* font, const Uint32& fontSize, String& string, const Float& maxWidth, |
| 521 | const Uint32& style, const Uint32& tabWidth, const Float& outlineThickness, |
| 522 | std::optional<Float> tabOffset, Uint32 textHints ) { |
| 523 | |
| 524 | if ( string.empty() || NULL == font ) |
| 525 | return false; |
| 526 | |
| 527 | LineWrapInfo lineWrap = LineWrap::computeLineBreaks( |
| 528 | string, font, fontSize, maxWidth, LineWrapMode::Word, style, outlineThickness, |
| 529 | tabOffset.has_value(), tabWidth, tabOffset ? *tabOffset : 0.f, textHints ); |
| 530 | |
| 531 | if ( lineWrap.wraps.size() <= 1 ) |
| 532 | return false; |
| 533 | |
| 534 | for ( Int64 i = lineWrap.wraps.size() - 1; i > 0; i-- ) { |
| 535 | if ( string[lineWrap.wraps[i]] != '\n' ) // Skip real line-breaks! |
| 536 | string.insert( lineWrap.wraps[i], '\n' ); |
| 537 | } |
| 538 | |
| 539 | return true; |
| 540 | } |
| 541 | |
| 542 | bool Text::hardWrapText( String& string, const Float& maxWidth, const FontStyleConfig& config, |
| 543 | const Uint32& tabWidth, std::optional<Float> tabOffset, |