diff --git a/src/font/text.cpp b/src/font/text.cpp index 87b808e7f7e..254c38ed369 100644 --- a/src/font/text.cpp +++ b/src/font/text.cpp @@ -436,13 +436,14 @@ void pango_text::add_attribute_fg_color(const unsigned start_offset, const unsig } } -void pango_text::add_attribute_font_family(const unsigned start_offset, const unsigned end_offset, const std::string& family) +void pango_text::add_attribute_font_family(const unsigned start_offset, const unsigned end_offset, font::family_class family) { attribute_start_offset_ = start_offset; attribute_end_offset_ = end_offset; if (attribute_start_offset_ != attribute_end_offset_) { - PangoAttribute *attr = pango_attr_family_new(family.c_str()); + const t_string& family_name = get_font_families(family); + PangoAttribute *attr = pango_attr_family_new(family_name.c_str()); attr->start_index = attribute_start_offset_; attr->end_index = attribute_end_offset_; diff --git a/src/font/text.hpp b/src/font/text.hpp index cb9bc60599f..26127950bc2 100644 --- a/src/font/text.hpp +++ b/src/font/text.hpp @@ -382,7 +382,7 @@ public: * @param end_offset Byte index of the cursor where size change ends * @param family The font family */ - void add_attribute_font_family(const unsigned start_offset, const unsigned end_offset, const std::string& family); + void add_attribute_font_family(const unsigned start_offset, const unsigned end_offset, font::family_class family); /** Clears all attributes from the global attribute list */ void clear_attribute_list(); diff --git a/src/gui/core/canvas.cpp b/src/gui/core/canvas.cpp index df17f4cbb43..549f7040c62 100644 --- a/src/gui/core/canvas.cpp +++ b/src/gui/core/canvas.cpp @@ -473,7 +473,7 @@ void text_shape::draw(wfl::map_formula_callable& variables) } else if (name == "font_size"||name == "size") { text_renderer.add_attribute_size(start, end, attr["value"].to_int(font::SIZE_NORMAL)); } else if (name == "font_family"||name == "face") { - text_renderer.add_attribute_font_family(start, end, attr["value"].str(font::get_font_families(font::FONT_SANS_SERIF))); + text_renderer.add_attribute_font_family(start, end, font::str_to_family_class(attr["value"])); } else if (name == "weight") { text_renderer.add_attribute_weight(start, end, decode_text_weight(attr["value"])); } else if (name == "style") {