diff --git a/src/gui/core/canvas.cpp b/src/gui/core/canvas.cpp index 4e9673ff23c..4a5cf81c3d4 100644 --- a/src/gui/core/canvas.cpp +++ b/src/gui/core/canvas.cpp @@ -450,7 +450,6 @@ text_shape::text_shape(const config& cfg, wfl::action_function_symbol_table& fun , font_style_(decode_font_style(cfg["font_style"])) , text_alignment_(cfg["text_alignment"]) , color_(cfg["color"]) - , ftext_(cfg["text"]) , text_(cfg["text"]) , parse_text_as_formula_(cfg["parse_text_as_formula"].to_bool(true)) , text_markup_(cfg["text_markup"], false) @@ -479,11 +478,11 @@ void text_shape::draw(wfl::map_formula_callable& variables) // We first need to determine the size of the text which need the rendered // text. So resolve and render the text first and then start to resolve // the other formulas. - if (parse_text_as_formula_) { - text_ = ftext_(variables); - } + const auto text = parse_text_as_formula_ + ? typed_formula{text_}(variables) + : text_.t_str(); - if(text_.empty()) { + if(text.empty()) { DBG_GUI_D << "Text: no text to render, leave."; return; } @@ -504,7 +503,7 @@ void text_shape::draw(wfl::map_formula_callable& variables) text_renderer .set_link_aware(link_aware_(variables)) .set_link_color(link_color_(variables)) - .set_text(text_, text_markup_(variables)); + .set_text(text, text_markup_(variables)); text_renderer.set_family_class(font_family_) .set_font_size(font_size_(variables)) @@ -546,7 +545,7 @@ void text_shape::draw(wfl::map_formula_callable& variables) texture tex = text_renderer.render_and_get_texture(); if(!tex) { - DBG_GUI_D << "Text: Rendering '" << text_ << "' resulted in an empty canvas, leave."; + DBG_GUI_D << "Text: Rendering '" << text << "' resulted in an empty canvas, leave."; return; } diff --git a/src/gui/core/canvas_private.hpp b/src/gui/core/canvas_private.hpp index 0c1909cd9b2..6a11a3e7045 100644 --- a/src/gui/core/canvas_private.hpp +++ b/src/gui/core/canvas_private.hpp @@ -17,7 +17,6 @@ #include "gui/auxiliary/typed_formula.hpp" #include "font/attributes.hpp" -#include "tstring.hpp" namespace gui2 { @@ -265,8 +264,7 @@ private: typed_formula color_; /** The text to draw. */ - typed_formula ftext_; - t_string text_; + config::attribute_value text_; /** Whether to parse text_ as WFL formula */ bool parse_text_as_formula_;