widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #12496
[Merge] lp:~widelands-dev/widelands/bug-1744583_fix_building_help into lp:widelands
kaputtnik has proposed merging lp:~widelands-dev/widelands/bug-1744583_fix_building_help into lp:widelands.
Commit message:
Fixing buildinghelp by adding a method to enclose strings in rt tags
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1744583 in widelands: "Building help looks weird"
https://bugs.launchpad.net/widelands/+bug/1744583
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1744583_fix_building_help/+merge/337509
Fixing buildinghelp by adding a method to enclose strings in rt tags.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1744583_fix_building_help into lp:widelands.
=== modified file 'src/graphic/text_layout.cc'
--- src/graphic/text_layout.cc 2017-05-25 12:30:40 +0000
+++ src/graphic/text_layout.cc 2018-02-10 20:30:21 +0000
@@ -141,6 +141,12 @@
return f.str();
}
+std::string as_richtext(const std::string& txt) {
+ static boost::format f("<rt>%s</rt>");
+ f % txt;
+ return f.str();
+}
+
std::string as_tooltip(const std::string& txt) {
static boost::format f("<rt><p><font face=sans size=%i bold=1 color=%s>%s</font></p></rt>");
=== modified file 'src/graphic/text_layout.h'
--- src/graphic/text_layout.h 2017-05-21 18:15:17 +0000
+++ src/graphic/text_layout.h 2018-02-10 20:30:21 +0000
@@ -84,6 +84,7 @@
const RGBColor& clr = UI_FONT_CLR_FG,
UI::FontSet::Face face = UI::FontSet::Face::kSans);
+std::string as_richtext(const std::string&);
std::string as_tooltip(const std::string&);
std::string as_waresinfo(const std::string&);
std::string as_game_tip(const std::string&);
=== modified file 'src/wui/helpwindow.cc'
--- src/wui/helpwindow.cc 2018-02-02 11:12:04 +0000
+++ src/wui/helpwindow.cc 2018-02-10 20:30:21 +0000
@@ -56,7 +56,7 @@
std::unique_ptr<LuaTable> return_table = cr->pop_table();
return_table->do_not_warn_about_unaccessed_keys(); // We won't display the title here
textarea_->force_new_renderer();
- textarea_->set_text(as_waresinfo(return_table->get_string("text")));
+ textarea_->set_text(as_richtext(return_table->get_string("text")));
} catch (LuaError& err) {
textarea_->set_text(err.what());
}
Follow ups