mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-14 10:30:56 +00:00
GUI2/Canvas: accept the standard values for the family/face attribute
Ie, "script", "monospace", etc, instead of a specific font name.
This commit is contained in:
parent
85f47f0a7e
commit
96f8e7604f
|
@ -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_;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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") {
|
||||
|
|
Loading…
Reference in New Issue
Block a user