Commit 7d58d826 authored by Dick Hollenbeck's avatar Dick Hollenbeck

common/gal/stroke_font.cpp was segfaulting in wx 2.8 when drawing multi-line string.

parent e2b7ba4b
...@@ -186,17 +186,18 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double ...@@ -186,17 +186,18 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
m_gal->SetLineWidth( m_gal->GetLineWidth() * BOLD_FACTOR ); m_gal->SetLineWidth( m_gal->GetLineWidth() * BOLD_FACTOR );
// Split multiline strings into separate ones and draw them line by line // Split multiline strings into separate ones and draw them line by line
int begin = 0; size_t begin = 0;
int newlinePos = aText.Find( '\n' ); size_t newlinePos = aText.find( '\n' );
while( newlinePos != wxNOT_FOUND ) while( newlinePos != aText.npos )
{ {
size_t length = newlinePos - begin; size_t length = newlinePos - begin;
drawSingleLineText( aText.Mid( begin, length ) ); drawSingleLineText( aText.Mid( begin, length ) );
m_gal->Translate( VECTOR2D( 0.0, lineHeight ) ); m_gal->Translate( VECTOR2D( 0.0, lineHeight ) );
begin = newlinePos + 1; begin = newlinePos + 1;
newlinePos = aText.find( '\n', begin + 1 ); newlinePos = aText.find( '\n', begin );
} }
// Draw the last (or the only one) line // Draw the last (or the only one) line
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment