@@ -76,6 +76,11 @@ void GameUI::init()
76
76
m_guitext_chat = gui::StaticText::add (guienv, L" " , core::rect<s32>(0 , 0 , 0 , 0 ),
77
77
// false, false); // Disable word wrap as of now
78
78
false , true , guiroot);
79
+ u16 chat_font_size = g_settings->getU16 (" chat_font_size" );
80
+ if (chat_font_size != 0 ) {
81
+ m_guitext_chat->setOverrideFont (g_fontengine->getFont (
82
+ chat_font_size, FM_Unspecified));
83
+ }
79
84
80
85
// Profiler text (size is updated when text is updated)
81
86
m_guitext_profiler = gui::StaticText::add (guienv, L" <Profiler>" ,
@@ -213,24 +218,22 @@ void GameUI::showTranslatedStatusText(const char *str)
213
218
214
219
void GameUI::setChatText (const EnrichedString &chat_text, u32 recent_chat_count)
215
220
{
216
- setStaticText (m_guitext_chat, chat_text);
217
221
218
222
// Update gui element size and position
219
223
s32 chat_y = 5 ;
220
224
221
225
if (m_flags.show_debug )
222
226
chat_y += 2 * g_fontengine->getLineHeight ();
223
227
224
- // first pass to calculate height of text to be set
225
228
const v2u32 &window_size = RenderingEngine::get_instance ()->getWindowSize ();
226
- s32 width = std::min (g_fontengine-> getTextWidth (chat_text. c_str ()) + 10 ,
227
- window_size. X - 20 );
228
- m_guitext_chat-> setRelativePosition (core::rect<s32>( 10 , chat_y, width,
229
- chat_y + window_size.Y ));
230
-
231
- // now use real height of text and adjust rect according to this size
232
- m_guitext_chat->setRelativePosition (core::rect<s32>( 10 , chat_y, width,
233
- chat_y + m_guitext_chat-> getTextHeight ()) );
229
+
230
+ core::rect<s32> chat_size ( 10 , chat_y,
231
+ window_size. X - 20 , 0 );
232
+ chat_size. LowerRightCorner . Y = std::min ((s32) window_size.Y ,
233
+ m_guitext_chat-> getTextHeight () + chat_y);
234
+
235
+ m_guitext_chat->setRelativePosition (chat_size);
236
+ setStaticText (m_guitext_chat, chat_text );
234
237
235
238
m_recent_chat_count = recent_chat_count;
236
239
}
0 commit comments