From ecb4df80a0b24efc9f9b37dbfc79ff591ca78c5b Mon Sep 17 00:00:00 2001 From: Charles Lohr Date: Fri, 27 Aug 2004 12:49:25 +0000 Subject: [PATCH] Allow for forced new lines when wrapping. Did I do this right? --- stepmania/src/BitmapText.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/stepmania/src/BitmapText.cpp b/stepmania/src/BitmapText.cpp index 3a35033e40..2cdba848a7 100644 --- a/stepmania/src/BitmapText.cpp +++ b/stepmania/src/BitmapText.cpp @@ -346,17 +346,24 @@ void BitmapText::SetText( CString sText, CString sAlternateText, int iWrapWidthP { CString sToAdd = " " + sWord; int iWidthToAdd = m_pFont->GetLineWidthInSourcePixels(L" ") + iWidthWord; - if( iCurLineWidth + iWidthToAdd <= iWrapWidthPixels ) // will fit on current line - { - sCurLine += sToAdd; - iCurLineWidth += iWidthToAdd; - } - else + if( sWord == "\n" ) //Check to see if it's a forced newline { m_wTextLines.push_back( CStringToWstring(sCurLine) ); - sCurLine = sWord; - iCurLineWidth = iWidthWord; - } + sCurLine = ""; + iCurLineWidth = 0; + } + else + if( iCurLineWidth + iWidthToAdd <= iWrapWidthPixels ) // will fit on current line + { + sCurLine += sToAdd; + iCurLineWidth += iWidthToAdd; + } + else + { + m_wTextLines.push_back( CStringToWstring(sCurLine) ); + sCurLine = sWord; + iCurLineWidth = iWidthWord; + } } } m_wTextLines.push_back( CStringToWstring(sCurLine) );