← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1767130-japanese into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1767130-japanese into lp:widelands.

Commit message:
Converted geologists' messages to new font renderer. Added fallback message to game message menu when old font renderer is used, to make such bugs easier to find in the future.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1767130 in widelands: "Font of geologist messages not correctly handled"
  https://bugs.launchpad.net/widelands/+bug/1767130

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1767130-japanese/+merge/345003
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1767130-japanese into lp:widelands.
=== modified file 'src/logic/map_objects/tribes/worker.cc'
--- src/logic/map_objects/tribes/worker.cc	2018-04-07 16:59:00 +0000
+++ src/logic/map_objects/tribes/worker.cc	2018-05-03 06:33:07 +0000
@@ -34,6 +34,7 @@
 #include "economy/road.h"
 #include "economy/transfer.h"
 #include "graphic/rendertarget.h"
+#include "graphic/text_constants.h"
 #include "helper.h"
 #include "io/fileread.h"
 #include "io/filewrite.h"
@@ -975,10 +976,12 @@
 
 		// Geologist also sends a message notifying the player
 		if (rdescr && rdescr->detectable() && position.field->get_resources_amount()) {
+			const int width = g_gr->images().get(rdescr->representative_image())->width();
 			const std::string message =
-			   (boost::format("<rt image=%s><p font-face=serif font-size=14>%s</p></rt>") %
-			    rdescr->representative_image() % _("A geologist found resources."))
-			      .str();
+			   (boost::format("<div padding_r=10><p><img width=%d src=%s></p></div>"
+							  "<div width=*><p><font size=%d>%s</font></p></div>") %
+				width % rdescr->representative_image() % UI_FONT_SIZE_MESSAGE % _("A geologist found resources."))
+				  .str();
 
 			Message::Type message_type = Message::Type::kGeologists;
 			if (rdescr->name() == "coal")

=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc	2018-04-07 16:59:00 +0000
+++ src/wui/game_message_menu.cc	2018-05-03 06:33:07 +0000
@@ -329,7 +329,9 @@
 			try {
 				message_body.force_new_renderer();
 				message_body.set_text(as_message(message->heading(), message->body()));
-			} catch (const std::exception&) {
+			} catch (const std::exception& e) {
+				log(
+				   "Game Message Menu: falling back to old font renderer:\n%s\n%s\n", message->body().c_str(), e.what());
 				message_body.force_new_renderer(false);
 				message_body.set_text(
 				   (boost::format("<rt><p font-size=18 font-weight=bold font-color=D1D1D1>%s<br></p>"


Follow ups