diff --git a/smc/data/gui/layout/debugtext.layout b/smc/data/gui/layout/debugtext.layout
index 20747090b..190966054 100644
--- a/smc/data/gui/layout/debugtext.layout
+++ b/smc/data/gui/layout/debugtext.layout
@@ -9,7 +9,8 @@
-
+
+
diff --git a/smc/src/gui/generic.cpp b/smc/src/gui/generic.cpp
index b712b121d..29297d31b 100644
--- a/smc/src/gui/generic.cpp
+++ b/smc/src/gui/generic.cpp
@@ -374,8 +374,10 @@ void Draw_Static_Text( const std::string &text, const Color *color_text /* = &wh
text_default->setXPosition( CEGUI::UDim( 0, ( game_res_w * 0.5f - text_width * 0.5f ) * global_upscalex ) );
text_default->moveToFront();
+ float text_height = font->getLineSpacing();
+ text_height *= 1 + std::count(text.begin(), text.end(), '\n');
// set window height
- text_default->setHeight( CEGUI::UDim( 0, (font->getFontHeight() * 2) + ( 12 * global_upscaley ) ) );
+ text_default->setHeight( CEGUI::UDim( 0, text_height + ( 12 * global_upscaley ) ) );
while( draw )
{
diff --git a/smc/src/gui/hud.cpp b/smc/src/gui/hud.cpp
index 801897526..6580bdc7b 100644
--- a/smc/src/gui/hud.cpp
+++ b/smc/src/gui/hud.cpp
@@ -977,13 +977,20 @@ void cDebugDisplay :: Update( void )
// update position
CEGUI::Font *font = &CEGUI::FontManager::getSingleton().get( "bluebold_medium" );
float text_width = font->getTextExtent( gui_text ) * global_downscalex;
+ float text_height = font->getLineSpacing() * global_downscaley;
+ // fixme : works only correctly for one too long line
if( text_width > 800.0f )
{
+ // add wrapped newlines
+ text_height *= 1 + static_cast(text_width / 800.0f);
text_width = 800.0f;
}
- m_text_debug_text->setWidth( CEGUI::UDim( 0, ( text_width + 15 ) * global_upscalex ) );
+ // add newlines
+ text_height *= 1 + std::count(m_text.begin(), m_text.end(), '\n');
+
+ m_text_debug_text->setSize( CEGUI::UVector2( CEGUI::UDim( 0, ( text_width + 15 ) * global_upscalex ), CEGUI::UDim( 0, ( text_height + 15 ) * global_upscaley ) ) );
m_text_debug_text->setXPosition( CEGUI::UDim( 0, ( ( game_res_w * 0.5f ) - text_width * 0.5f ) * global_upscalex ) );
}
}