From 45ca791387113ef227febaea3d6c8107db52935b Mon Sep 17 00:00:00 2001 From: Iris Morelle Date: Sat, 13 Mar 2021 14:58:08 -0300 Subject: [PATCH] ui: Fix ThemeWML [label] text_rgb= being horribly broken First cause of breakage seems to be that the introduction of color_t changed the size of the colour components from something longer than 8 bits to 8 bits, resulting in stringstream outputting invalid UTF-8. The second cause is the dropping of GUI1 markup along with SDL_ttf. --- changelog.md | 1 + src/display.cpp | 18 +++--------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/changelog.md b/changelog.md index 353832a59d6c..a8a7e855f198 100644 --- a/changelog.md +++ b/changelog.md @@ -27,6 +27,7 @@ * Make the warning about loading saves from old versions much clearer. ### WML Engine * Standard Location Filters now support gives_income=yes|no to make it simpler to match villages regardless of owner + * Fixed ThemeWML `[label] font_rgb=` generating text elements with broken UTF-8 sequences. ### Miscellaneous and Bug Fixes * Added support for 1.14’s tag names in `[terrain_defaults]` (issue #5308). * Replaced legacy SDL_ttf/FriBidi-based font rendering used in old GUI1 code paths with Pango. diff --git a/src/display.cpp b/src/display.cpp index 6becbd853de5..ea46207993f6 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -1434,19 +1434,8 @@ static void draw_label(CVideo& video, surface target, const theme::label& label) { //log_scope("draw label"); - const color_t& RGB = label.font_rgb(); - - std::string c_start="<"; - std::string c_sep=","; - std::string c_end=">"; - std::stringstream color; - color<< c_start << RGB.r << c_sep << RGB.g << c_sep << RGB.b << c_end; - std::string text = label.text(); - - if(label.font_rgb_set()) { - color<