diff --git a/data/schema/gui/generic.cfg b/data/schema/gui/generic.cfg index 5bc80b456c1..5bcf4d19163 100644 --- a/data/schema/gui/generic.cfg +++ b/data/schema/gui/generic.cfg @@ -147,6 +147,7 @@ {DEFAULT_KEY "text_link_aware" f_bool false} {DEFAULT_KEY "text_link_color" string "#ffff00"} {DEFAULT_KEY "text_wrap_mode" f_unsigned 0} + {DEFAULT_KEY "outline" f_bool false} {DEFAULT_KEY "h" f_unsigned 0} {DEFAULT_KEY "w" f_unsigned 0} {DEFAULT_KEY "x" f_unsigned 0} diff --git a/src/gui/core/canvas.cpp b/src/gui/core/canvas.cpp index 58363517c38..ee4693ca353 100644 --- a/src/gui/core/canvas.cpp +++ b/src/gui/core/canvas.cpp @@ -412,6 +412,7 @@ text_shape::text_shape(const config& cfg) , highlight_start_(cfg["highlight_start"], 0) , highlight_end_(cfg["highlight_end"], 0) , highlight_color_(cfg["highlight_color"], color_t::from_hex_string("215380")) + , outline_(cfg["outline"], false) { if(!font_size_.has_formula()) { VALIDATE(font_size_(), _("Text has a font size of 0.")); @@ -441,7 +442,6 @@ void text_shape::draw(wfl::map_formula_callable& variables) text_renderer.set_highlight_area(highlight_start_(variables), highlight_end_(variables), highlight_color_(variables)); - text_renderer .set_link_aware(link_aware_(variables)) .set_link_color(link_color_(variables)) @@ -457,7 +457,8 @@ void text_shape::draw(wfl::map_formula_callable& variables) .set_ellipse_mode(variables.has_key("text_wrap_mode") ? static_cast(variables.query_value("text_wrap_mode").as_int()) : PANGO_ELLIPSIZE_END) - .set_characters_per_line(characters_per_line_); + .set_characters_per_line(characters_per_line_) + .set_add_outline(outline_(variables)); wfl::map_formula_callable local_variables(variables); const auto [tw, th] = text_renderer.get_size(); diff --git a/src/gui/core/canvas_private.hpp b/src/gui/core/canvas_private.hpp index 4d191282504..4257f89768f 100644 --- a/src/gui/core/canvas_private.hpp +++ b/src/gui/core/canvas_private.hpp @@ -451,8 +451,12 @@ private: /** Start and end offsets for highlight */ typed_formula highlight_start_; typed_formula highlight_end_; + /** The color to be used for highlighting */ typed_formula highlight_color_; + + /** Whether to apply a text outline. */ + typed_formula outline_; }; }