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:;
+3
View File
@@ -13,6 +13,7 @@
#include <util/alignment.hpp>
#include <util/io/package.hpp>
#include <data/font.hpp>
#include <wx/regex.h>
DECLARE_POINTER_TYPE(Font);
DECLARE_POINTER_TYPE(SymbolFont);
@@ -88,6 +89,8 @@ class SymbolFont : public Packaged {
double text_margin_bottom;
Alignment text_alignment;
bool merge_numbers; ///< Merge numbers? e.g. "11" is a single symbol ('1' must not exist as a symbol)
String as_text; ///< Things to render as text
mutable wxRegEx as_text_r;
InsertSymbolMenuP insert_symbol_menu;
wxMenu* processed_insert_symbol_menu;
+3 -2
View File
@@ -49,7 +49,7 @@ template <> void GetDefaultMember::handle(const Version& v) {
// ----------------------------------------------------------------------------- : Versions
// NOTE: Don't use leading zeroes, they mean octal
const Version app_version = 304; // 0.3.4
const Version app_version = 305; // 0.3.5
#ifdef UNICODE
const Char* version_suffix = _(" (beta)");
#else
@@ -66,5 +66,6 @@ const Char* version_suffix = _(" (beta, ascii build)");
* 0.3.2 : package dependencies
* 0.3.3 : keyword separator before/after
* 0.3.4 : html export; choice rendering based on scripted 'image'
* 0.3.5 : word lists, symbol font 'as text'
*/
const Version file_version = 304; // 0.3.4
const Version file_version = 305; // 0.3.5