mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 13:37:00 -04:00
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:
@@ -1,4 +1,4 @@
|
|||||||
mse version: 0.3.2
|
mse version: 0.3.5
|
||||||
# Symbol font in the beveled style used for casting costs on FPM cards
|
# Symbol font in the beveled style used for casting costs on FPM cards
|
||||||
# Note:
|
# Note:
|
||||||
# Define small_mana_t:="mana_t(_old)?.png" in the init script of the style
|
# Define small_mana_t:="mana_t(_old)?.png" in the init script of the style
|
||||||
@@ -175,7 +175,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
code: S
|
code: S
|
||||||
image: mana_s.png
|
image: mana_s.png
|
||||||
merge numbers: true
|
as text: .|[0-9]+(?!/)
|
||||||
text font:
|
text font:
|
||||||
name: MPlantin
|
name: MPlantin
|
||||||
size: 15
|
size: 15
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
mse version: 0.3.3
|
mse version: 0.3.5
|
||||||
# Symbol font in the 'futuristic' style, used for casting costs on futureshift cards
|
# Symbol font in the 'futuristic' style, used for casting costs on futureshift cards
|
||||||
|
|
||||||
image font size: 135
|
image font size: 135
|
||||||
@@ -136,7 +136,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
code: S
|
code: S
|
||||||
image: mana_s.png
|
image: mana_s.png
|
||||||
merge numbers: true
|
as text: .|[0-9]+(?!/)
|
||||||
text font:
|
text font:
|
||||||
name: MPlantin
|
name: MPlantin
|
||||||
size: 15
|
size: 15
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
mse version: 0.3.2
|
mse version: 0.3.5
|
||||||
# Symbol font in the 'popup' style, used for casting costs on modern cards
|
# Symbol font in the 'popup' style, used for casting costs on modern cards
|
||||||
|
|
||||||
image font size: 135
|
image font size: 135
|
||||||
@@ -188,7 +188,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
code: S
|
code: S
|
||||||
image: mana_s.png
|
image: mana_s.png
|
||||||
merge numbers: true
|
as text: .|[0-9]+(?!/)
|
||||||
text font:
|
text font:
|
||||||
name: MPlantin
|
name: MPlantin
|
||||||
size: 15
|
size: 15
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
mse version: 0.3.2
|
mse version: 0.3.5
|
||||||
# Symbol font in the normal, flat, style, used for text boxes and on old style cards
|
# Symbol font in the normal, flat, style, used for text boxes and on old style cards
|
||||||
# Note:
|
# Note:
|
||||||
# Define mana_t := {"new|old|older"} in the init script of the style
|
# Define mana_t := {"new|old|older"} in the init script of the style
|
||||||
@@ -195,7 +195,7 @@ symbol:
|
|||||||
symbol:
|
symbol:
|
||||||
code: S
|
code: S
|
||||||
image: mana_s.png
|
image: mana_s.png
|
||||||
merge numbers: true
|
as text: .|[0-9]+(?!/)
|
||||||
text font:
|
text font:
|
||||||
name: MPlantin
|
name: MPlantin
|
||||||
size: 15
|
size: 15
|
||||||
|
|||||||
+90
-45
@@ -12,20 +12,20 @@ init script:
|
|||||||
|
|
||||||
############################################################## Sorting mana symbols
|
############################################################## Sorting mana symbols
|
||||||
|
|
||||||
# correctly sort mana symbols
|
# correctly sort a mana symbol (no guild mana)
|
||||||
mana_sort := sort_rule(order: "ordered(XYZ)"
|
mana_sort := sort_rule(order: "XYZ[0123456789]S(WUBRG)")
|
||||||
+ "mixed(0123456789)"
|
# correctly sort guild mana
|
||||||
+ "ordered(S)"
|
mana_sort_guild := replace_rule(
|
||||||
+ "reverse_order("
|
match: "./.|././.|./././.|.[|]",
|
||||||
+ " pattern(./././. cycle(WUBRG))"
|
in_context: "(^|[^/])<match>($|[^/])",
|
||||||
+ " pattern(././. cycle(WUBRG))"
|
replace: {sort_text(order:"in_place((WUBRG)")}
|
||||||
+ " pattern(./. cycle(WUBRG))"
|
)
|
||||||
+ " pattern(|. WUBRG)|"
|
mana_has_guild := match_rule(match: "[/|]") # Is there guild or half mana in the input?
|
||||||
+ " pattern(./ WUBRG)"
|
# A mana cost can contain both normal and guild mana
|
||||||
+ " pattern(/. WUBRG)"
|
mana_filter := to_upper + {
|
||||||
+ " cycle(WUBRG)"
|
if mana_has_guild() then mana_sort_guild()
|
||||||
+ ")")
|
else mana_sort()
|
||||||
mana_filter := to_upper + mana_sort
|
}
|
||||||
# Like mana filter, only also allow tap symbols:
|
# Like mana filter, only also allow tap symbols:
|
||||||
tap_filter := sort_rule(order: "<T>")
|
tap_filter := sort_rule(order: "<T>")
|
||||||
mana_filter_t := replace_rule( # Remove [] used for forcing mana symbols
|
mana_filter_t := replace_rule( # Remove [] used for forcing mana symbols
|
||||||
@@ -122,8 +122,11 @@ init script:
|
|||||||
}
|
}
|
||||||
|
|
||||||
# The color of a card
|
# The color of a card
|
||||||
is_artifact := match_rule(match: "(?i)Artifact")
|
is_creature := match_rule(match: "(?i)Creature|Tribal")
|
||||||
is_land := match_rule(match: "(?i)Land")
|
is_artifact := match_rule(match: "(?i)Artifact")
|
||||||
|
is_land := match_rule(match: "(?i)Land")
|
||||||
|
is_enchantment := match_rule(match: "(?i)Enchantment")
|
||||||
|
is_spell := match_rule(match: "(?i)Instant|Sorcery")
|
||||||
card_color := {
|
card_color := {
|
||||||
# usually the color of mana
|
# usually the color of mana
|
||||||
text_color := text_to_color(rules_text, land: is_land(type), card_name: card_name);
|
text_color := text_to_color(rules_text, land: is_land(type), card_name: card_name);
|
||||||
@@ -174,11 +177,11 @@ init script:
|
|||||||
# land
|
# land
|
||||||
if card.rarity != "basic land" then "K" # nonbasic land
|
if card.rarity != "basic land" then "K" # nonbasic land
|
||||||
else (
|
else (
|
||||||
if contains(card.name, match:"Plains") then "M"
|
if contains(card.name, match:"Plains") then "M"
|
||||||
else if contains(card.name, match:"Island") then "N"
|
else if contains(card.name, match:"Island") then "N"
|
||||||
else if contains(card.name, match:"Swamp") then "O"
|
else if contains(card.name, match:"Swamp") then "O"
|
||||||
else if contains(card.name, match:"Mountain") then "P"
|
else if contains(card.name, match:"Mountain") then "P"
|
||||||
else if contains(card.name, match:"Forest") then "Q"
|
else if contains(card.name, match:"Forest") then "Q"
|
||||||
else "L" # other basic land
|
else "L" # other basic land
|
||||||
)
|
)
|
||||||
) else if is_null_cost(casting_cost) then (
|
) else if is_null_cost(casting_cost) then (
|
||||||
@@ -410,11 +413,26 @@ init script:
|
|||||||
replace_rule(
|
replace_rule(
|
||||||
match: " - ",
|
match: " - ",
|
||||||
replace: " — ");
|
replace: " — ");
|
||||||
|
|
||||||
# Move the cursor past the separator in the p/t and type boxes
|
# Move the cursor past the separator in the p/t and type boxes
|
||||||
type_over_pt := replace_rule(match:"/$", replace:"")
|
type_over_pt := replace_rule(match:"/$", replace:"")
|
||||||
type_over_type := replace_rule(match:" ?-$", replace:"")
|
type_over_type := replace_rule(match:" ?-$", replace:"")
|
||||||
|
|
||||||
|
super_type_filter :=
|
||||||
|
type_over_type +
|
||||||
|
tag_remove_rule(tag: "<word-list-") +
|
||||||
|
{ "<word-list-type>{input}</word-list-type>" }
|
||||||
|
|
||||||
|
sub_type_filter :=
|
||||||
|
tag_remove_rule(tag: "<word-list-") +
|
||||||
|
{ if is_creature(type) then "<word-list-creature>{ input}</word-list-creature>"
|
||||||
|
else if is_land(type) then "<word-list-land>{ input}</word-list-land>"
|
||||||
|
else if is_artifact(type) then "<word-list-artifact>{ input}</word-list-artifact>"
|
||||||
|
else if is_enchantment(type) then "<word-list-enchantment>{input}</word-list-enchantment>"
|
||||||
|
else if is_spell(type) then "<word-list-spell>{ input}</word-list-spell>"
|
||||||
|
else input
|
||||||
|
}
|
||||||
|
|
||||||
# Shape of cards, can be changed in style files
|
# Shape of cards, can be changed in style files
|
||||||
card_shape := { "normal" }
|
card_shape := { "normal" }
|
||||||
|
|
||||||
@@ -711,11 +729,12 @@ card field:
|
|||||||
name: super type
|
name: super type
|
||||||
icon: stats/creature_type.png
|
icon: stats/creature_type.png
|
||||||
editable: false
|
editable: false
|
||||||
script: type_over_type(value)
|
script: super_type_filter(value)
|
||||||
card field:
|
card field:
|
||||||
type: text
|
type: text
|
||||||
name: sub type
|
name: sub type
|
||||||
icon: stats/creature_type.png
|
icon: stats/creature_type.png
|
||||||
|
script: sub_type_filter(value, type:card.super_type)
|
||||||
editable: false
|
editable: false
|
||||||
card field:
|
card field:
|
||||||
type: text
|
type: text
|
||||||
@@ -930,13 +949,14 @@ card field:
|
|||||||
icon: stats/creature_type.png
|
icon: stats/creature_type.png
|
||||||
editable: false
|
editable: false
|
||||||
show statistics: false
|
show statistics: false
|
||||||
script: type_over_type(value)
|
script: super_type_filter(value)
|
||||||
card field:
|
card field:
|
||||||
type: text
|
type: text
|
||||||
name: sub type 2
|
name: sub type 2
|
||||||
icon: stats/creature_type.png
|
icon: stats/creature_type.png
|
||||||
editable: false
|
editable: false
|
||||||
show statistics: false
|
show statistics: false
|
||||||
|
script: sub_type_filter(value, type:card.super_type_2)
|
||||||
card field:
|
card field:
|
||||||
type: text
|
type: text
|
||||||
name: type 2
|
name: type 2
|
||||||
@@ -1205,32 +1225,57 @@ statistics category:
|
|||||||
|
|
||||||
# The following (until keywords) doesn't do anything yet
|
# The following (until keywords) doesn't do anything yet
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
############################################################## Word lists
|
############################################################## Word lists
|
||||||
|
|
||||||
#word list:
|
word list:
|
||||||
# name: card types
|
name: type
|
||||||
# word: Creature
|
word:
|
||||||
# word: Artifact
|
name: Basic
|
||||||
# word: Enchantment
|
is prefix: true
|
||||||
# word: Instant
|
word:
|
||||||
# word: Sorcery
|
name: Legendary
|
||||||
# word: Land
|
line below: true
|
||||||
# word: Legendary Creature
|
is prefix: true
|
||||||
# word: Legendary Artifact
|
word: Creature
|
||||||
# word: Legendary Enchantment
|
word: Artifact
|
||||||
# word: Legendary Land
|
word: Enchantment
|
||||||
|
word: Instant
|
||||||
|
word: Sorcery
|
||||||
|
word: Land
|
||||||
|
|
||||||
#word list:
|
word list:
|
||||||
# name: creature types
|
name: creature
|
||||||
# word: Goblin
|
word: Goblin
|
||||||
# word: Elf
|
word: Elf
|
||||||
# word: Wizard
|
word: Wizard
|
||||||
# word: Human
|
word: Human
|
||||||
|
# TODO: lots more
|
||||||
|
|
||||||
#word list:
|
word list:
|
||||||
# name: enchantment types
|
name: artifact
|
||||||
# word:
|
word:
|
||||||
# word: Aura
|
word: Equipment
|
||||||
|
|
||||||
|
word list:
|
||||||
|
name: land
|
||||||
|
word:
|
||||||
|
word: Plains
|
||||||
|
word: Island
|
||||||
|
word: Swamp
|
||||||
|
word: Mountain
|
||||||
|
word: Forest
|
||||||
|
|
||||||
|
word list:
|
||||||
|
name: enchantment
|
||||||
|
word:
|
||||||
|
word: Aura
|
||||||
|
|
||||||
|
word list:
|
||||||
|
name: spell
|
||||||
|
word:
|
||||||
|
word: Arcane
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ Such a package contains a [[file:format|data file]] called <tt>symbol-font</tt>
|
|||||||
| @symbols@ [[type:list]] of [[type:symbol font symbol]]s Symbols that make up this font.
|
| @symbols@ [[type:list]] of [[type:symbol font symbol]]s Symbols that make up this font.
|
||||||
| @text font@ [[type:font]] Font to use for drawing text on symbols, only used if there is a default symbol.
|
| @text font@ [[type:font]] Font to use for drawing text on symbols, only used if there is a default symbol.
|
||||||
| @scale text@ [[type:boolean]] @false@ Should text be scaled down to fit in a symbol?
|
| @scale text@ [[type:boolean]] @false@ Should text be scaled down to fit in a symbol?
|
||||||
| @merge numbers@ [[type:boolean]] @false@ Should a numeric value of multiple digits be rendered as a single symbol?
|
| @merge numbers@ [[type:boolean]] @false@ Should a numeric value of multiple digits be rendered as a single symbol?<br/>
|
||||||
|
Note: @merge numbers@ is deprecated, use @as text: [0-9]+@ instead.
|
||||||
|
| @as text@ [[type:regex]] @"."@ What should be rendered as a single piece of text?
|
||||||
| @text margin left@ [[type:double]] @0@ Margin on the left of the text in pixels.
|
| @text margin left@ [[type:double]] @0@ Margin on the left of the text in pixels.
|
||||||
| @text margin right@ [[type:double]] @0@ Margin on the right of the text in pixels.
|
| @text margin right@ [[type:double]] @0@ Margin on the right of the text in pixels.
|
||||||
| @text margin top@ [[type:double]] @0@ Margin on the top of the text in pixels.
|
| @text margin top@ [[type:double]] @0@ Margin on the top of the text in pixels.
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ IMPLEMENT_REFLECTION(SymbolFont) {
|
|||||||
REFLECT(symbols);
|
REFLECT(symbols);
|
||||||
REFLECT(text_font);
|
REFLECT(text_font);
|
||||||
REFLECT(scale_text);
|
REFLECT(scale_text);
|
||||||
REFLECT(merge_numbers);
|
REFLECT(as_text);
|
||||||
REFLECT(text_margin_left);
|
REFLECT(text_margin_left);
|
||||||
REFLECT(text_margin_right);
|
REFLECT(text_margin_right);
|
||||||
REFLECT(text_margin_top);
|
REFLECT(text_margin_top);
|
||||||
@@ -192,7 +192,23 @@ void SymbolFont::split(const String& text, SplitSymbols& out) const {
|
|||||||
goto next_symbol; // continue two levels
|
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));
|
out.push_back(DrawableSymbol(text.substr(pos, 1), 0));
|
||||||
pos += 1;
|
pos += 1;
|
||||||
next_symbol:;
|
next_symbol:;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <util/alignment.hpp>
|
#include <util/alignment.hpp>
|
||||||
#include <util/io/package.hpp>
|
#include <util/io/package.hpp>
|
||||||
#include <data/font.hpp>
|
#include <data/font.hpp>
|
||||||
|
#include <wx/regex.h>
|
||||||
|
|
||||||
DECLARE_POINTER_TYPE(Font);
|
DECLARE_POINTER_TYPE(Font);
|
||||||
DECLARE_POINTER_TYPE(SymbolFont);
|
DECLARE_POINTER_TYPE(SymbolFont);
|
||||||
@@ -88,6 +89,8 @@ class SymbolFont : public Packaged {
|
|||||||
double text_margin_bottom;
|
double text_margin_bottom;
|
||||||
Alignment text_alignment;
|
Alignment text_alignment;
|
||||||
bool merge_numbers; ///< Merge numbers? e.g. "11" is a single symbol ('1' must not exist as a symbol)
|
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;
|
InsertSymbolMenuP insert_symbol_menu;
|
||||||
wxMenu* processed_insert_symbol_menu;
|
wxMenu* processed_insert_symbol_menu;
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ template <> void GetDefaultMember::handle(const Version& v) {
|
|||||||
// ----------------------------------------------------------------------------- : Versions
|
// ----------------------------------------------------------------------------- : Versions
|
||||||
|
|
||||||
// NOTE: Don't use leading zeroes, they mean octal
|
// 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
|
#ifdef UNICODE
|
||||||
const Char* version_suffix = _(" (beta)");
|
const Char* version_suffix = _(" (beta)");
|
||||||
#else
|
#else
|
||||||
@@ -66,5 +66,6 @@ const Char* version_suffix = _(" (beta, ascii build)");
|
|||||||
* 0.3.2 : package dependencies
|
* 0.3.2 : package dependencies
|
||||||
* 0.3.3 : keyword separator before/after
|
* 0.3.3 : keyword separator before/after
|
||||||
* 0.3.4 : html export; choice rendering based on scripted 'image'
|
* 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
|
||||||
|
|||||||
Reference in New Issue
Block a user