mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Add <font:$family> tag, closes #24
This commit is contained in:
@@ -78,6 +78,7 @@ struct TextElementsFromString {
|
||||
int param_id;
|
||||
vector<Color> colors;
|
||||
vector<double> sizes;
|
||||
vector<String> fonts;
|
||||
/// put angle brackets around the text?
|
||||
bool bracket;
|
||||
|
||||
@@ -138,6 +139,14 @@ struct TextElementsFromString {
|
||||
} else if (is_substr(text, tag_start, _("</color"))) {
|
||||
if (!colors.empty()) colors.pop_back();
|
||||
}
|
||||
else if (is_substr(text, tag_start, _( "<font"))) {
|
||||
size_t colon = text.find_first_of(_(">:"), tag_start);
|
||||
if (colon < pos - 1 && text.GetChar(colon) == _(':')) {
|
||||
fonts.push_back(text.substr(colon+1, pos-colon-2));
|
||||
}
|
||||
} else if (is_substr(text, tag_start, _("</font"))) {
|
||||
if (!fonts.empty()) fonts.pop_back();
|
||||
}
|
||||
else if (is_substr(text, tag_start, _( "<size"))) {
|
||||
size_t colon = text.find_first_of(_(">:"), tag_start);
|
||||
if (colon < pos - 1 && text.GetChar(colon) == _(':')) {
|
||||
@@ -251,6 +260,7 @@ private:
|
||||
(code > 0 ? FONT_CODE : FONT_NORMAL) |
|
||||
(code_kw > 0 ? FONT_CODE_KW : FONT_NORMAL) |
|
||||
(code_string > 0 ? FONT_CODE_STRING : FONT_NORMAL),
|
||||
fonts.empty() ? nullptr : &fonts.back(),
|
||||
param > 0 || param_ref > 0
|
||||
? ¶m_colors[(param_id++) % param_colors_count]
|
||||
: !colors.empty()
|
||||
|
||||
Reference in New Issue
Block a user