Added as_text regex to symbol font as a more flexible replacement for merge_numbers.

This fixes "31/2" which is now rendered as "(3)(1/2)".
Reverted the mana_sort_guild change
Time for a version bump

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@618 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-08-23 16:58:08 +00:00
parent ff27322522
commit c3e10f2ccf
9 changed files with 125 additions and 58 deletions
+18 -2
View File
@@ -57,7 +57,7 @@ IMPLEMENT_REFLECTION(SymbolFont) {
REFLECT(symbols);
REFLECT(text_font);
REFLECT(scale_text);
REFLECT(merge_numbers);
REFLECT(as_text);
REFLECT(text_margin_left);
REFLECT(text_margin_right);
REFLECT(text_margin_top);
@@ -192,7 +192,23 @@ void SymbolFont::split(const String& text, SplitSymbols& out) const {
goto next_symbol; // continue two levels
}
}
// 3. unknown code, draw single character as text
// 3. draw multiple together as text?
if (!as_text.empty()) {
if (!as_text_r.IsValid()) {
as_text_r.Compile(_("^") + as_text, wxRE_ADVANCED);
}
if (as_text_r.IsValid()) {
if (as_text_r.Matches(text.substr(pos))) {
size_t start, len;
if (as_text_r.GetMatch(&start,&len) && start == 0) {
out.push_back(DrawableSymbol(text.substr(pos, len), 0));
pos += len;
goto next_symbol;
}
}
}
}
// 4. unknown code, draw single character as text
out.push_back(DrawableSymbol(text.substr(pos, 1), 0));
pos += 1;
next_symbol:;