Commit 70b48d72 authored by twanvl's avatar twanvl

Fixed bug in fields in style file;

No longer doing GetTextExtent("\n");
Moved pt boxes to style files;
parent c3dfc73e
...@@ -234,17 +234,6 @@ card style: ...@@ -234,17 +234,6 @@ card style:
color: rgb(0,0,0) color: rgb(0,0,0)
separator color: rgb(200,0,0) separator color: rgb(200,0,0)
pt box:
left: 271
top: 461
width: 81
height: 42
z index: 1
visible: { card.pt != "" }
render style: image
mask: mask_pt.png
include file: magic-blends.mse-include/card-ptboxes
############################# Copyright stuff ############################# Copyright stuff
illustrator: illustrator:
...@@ -268,3 +257,22 @@ card style: ...@@ -268,3 +257,22 @@ card style:
name: MPlantin name: MPlantin
size: 6 size: 6
color: { font_color() } color: { font_color() }
############################################################## Extra card fields
extra card field:
type: choice
name: pt box
script: card.card_color
extra card style:
pt box:
left: 271
top: 461
width: 81
height: 42
z index: 1
visible: { card.pt != "" }
render style: image
mask: mask_pt.png
include file: magic-blends.mse-include/card-ptboxes
...@@ -119,9 +119,9 @@ card style: ...@@ -119,9 +119,9 @@ card style:
size: 20 size: 20
color: rgb(0,0,0) color: rgb(0,0,0)
casting cost: casting cost:
left: 32 left: 17
top : 150 top : 150
width: 10 width: 25
height: 195 height: 195
alignment: top right alignment: top right
direction: vertical direction: vertical
...@@ -160,7 +160,7 @@ card style: ...@@ -160,7 +160,7 @@ card style:
casting cost 2: casting cost 2:
left: 334 left: 334
top : 170 top : 170
width: 10 width: 25
height: 170 height: 170
alignment: top right alignment: top right
direction: vertical direction: vertical
...@@ -335,16 +335,6 @@ card style: ...@@ -335,16 +335,6 @@ card style:
shadow color: rgb(0,0,0) shadow color: rgb(0,0,0)
shadow displacement x: 1 shadow displacement x: 1
shadow displacement y: 1 shadow displacement y: 1
ptsymbols:
left: 24
top: 340
width: 19
height: 103
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
power 2: power 2:
z index: 4 z index: 4
left: 334 left: 334
...@@ -377,16 +367,6 @@ card style: ...@@ -377,16 +367,6 @@ card style:
shadow color: rgb(0,0,0) shadow color: rgb(0,0,0)
shadow displacement x: 1 shadow displacement x: 1
shadow displacement y: 1 shadow displacement y: 1
ptsymbols 2:
left: 333
top: 58
width: 19
height: 103
z index: 1
visible: { card.power_2 != "" or card.toughness_2 != "" }
render style: image
choice images:
shieldsword: ptshieldsword-2.png
############################# Copyright stuff ############################# Copyright stuff
illustrator: illustrator:
...@@ -414,3 +394,36 @@ card style: ...@@ -414,3 +394,36 @@ card style:
name: MPlantin name: MPlantin
size: 7 size: 7
color: { font_color() } color: { font_color() }
############################################################## Extra card fields
extra card field:
type: choice
name: pt symbols
script: "shieldsword"
extra card field:
type: choice
name: pt symbols 2
script: "shieldsword"
extra card style:
pt symbols:
left: 24
top: 340
width: 19
height: 103
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
pt symbols 2:
left: 333
top: 58
width: 19
height: 103
z index: 1
visible: { card.power_2 != "" or card.toughness_2 != "" }
render style: image
choice images:
shieldsword: ptshieldsword-2.png
...@@ -141,9 +141,9 @@ card style: ...@@ -141,9 +141,9 @@ card style:
size: 20 size: 20
color: rgb(0,0,0) color: rgb(0,0,0)
casting cost: casting cost:
left: 35 left: 18
top : 55 top : 55
width: 10 width: 27
height: 250 height: 250
direction: vertical direction: vertical
alignment: top right alignment: top right
...@@ -271,16 +271,6 @@ card style: ...@@ -271,16 +271,6 @@ card style:
shadow color: rgb(0,0,0) shadow color: rgb(0,0,0)
shadow displacement x: 1 shadow displacement x: 1
shadow displacement y: 1 shadow displacement y: 1
ptsymbols:
left: 25
top: 362
width: 19
height: 103
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
############################# Card sorting / numbering ############################# Card sorting / numbering
############################# Copyright stuff ############################# Copyright stuff
...@@ -311,3 +301,22 @@ card style: ...@@ -311,3 +301,22 @@ card style:
name: MPlantin name: MPlantin
size: 7 size: 7
color: { font_color() } color: { font_color() }
############################################################## Extra card fields
extra card field:
type: choice
name: pt symbols
script: "shieldsword"
extra card style:
pt symbols:
left: 25
top: 362
width: 19
height: 103
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
...@@ -148,9 +148,9 @@ card style: ...@@ -148,9 +148,9 @@ card style:
size: 20 size: 20
color: rgb(0,0,0) color: rgb(0,0,0)
casting cost: casting cost:
left: 25 left: 18
top : 55 top : 55
width: 20 width: 27
height: 250 height: 250
direction: vertical direction: vertical
alignment: top right alignment: top right
...@@ -270,17 +270,6 @@ card style: ...@@ -270,17 +270,6 @@ card style:
shadow displacement x: 1 shadow displacement x: 1
shadow displacement y: 1 shadow displacement y: 1
ptsymbols:
left: 25
top: 362
width: 19
height: 103
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
############################# Copyright stuff ############################# Copyright stuff
illustrator: illustrator:
...@@ -315,3 +304,23 @@ card style: ...@@ -315,3 +304,23 @@ card style:
{ if card.font_color = "white" then rgb(255,255,255) { if card.font_color = "white" then rgb(255,255,255)
else if card.font_color = "black" then rgb(0,0,0) else if card.font_color = "black" then rgb(0,0,0)
else rgb(0,0,0) } else rgb(0,0,0) }
############################################################## Extra card fields
extra card field:
type: choice
name: pt symbols
script: "shieldsword"
extra card style:
pt symbols:
left: 25
top: 362
width: 19
height: 103
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
...@@ -163,9 +163,9 @@ card style: ...@@ -163,9 +163,9 @@ card style:
size: 13.85 size: 13.85
color: rgb(0,0,0) color: rgb(0,0,0)
casting cost: casting cost:
left: 31.24 left: 18.67
top : 45 top : 45
width: 6.93 width: 19.5
height: 173.16 height: 173.16
alignment: top right alignment: top right
direction: vertical direction: vertical
...@@ -178,9 +178,9 @@ card style: ...@@ -178,9 +178,9 @@ card style:
padding top: 0 padding top: 0
z index: 2 z index: 2
casting cost 2: casting cost 2:
left: 284.73 left: 272.16
top : 45 top : 45
width: 6.93 width: 19.5
height: 173.16 height: 173.16
alignment: top right alignment: top right
direction: vertical direction: vertical
...@@ -412,26 +412,6 @@ card style: ...@@ -412,26 +412,6 @@ card style:
shadow color: rgb(0,0,0) shadow color: rgb(0,0,0)
shadow displacement x: 1 shadow displacement x: 1
shadow displacement y: 1 shadow displacement y: 1
ptsymbols:
left: 23.32
top: 256
width: 13.16
height: 71.34
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
ptsymbols 2:
left: 276.81
top: 256
width: 13.16
height: 71.34
z index: 1
visible: { card.power_2 != "" or card.toughness_2 != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
############################# Copyright stuff ############################# Copyright stuff
illustrator: illustrator:
...@@ -484,3 +464,36 @@ card style: ...@@ -484,3 +464,36 @@ card style:
name: MPlantin name: MPlantin
size: 4.85 size: 4.85
color: { font_color_2() } color: { font_color_2() }
############################################################## Extra card fields
extra card field:
type: choice
name: pt symbols
script: "shieldsword"
extra card field:
type: choice
name: pt symbols 2
script: "shieldsword"
extra card style:
pt symbols:
left: 23.32
top: 256
width: 13.16
height: 71.34
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
pt symbols 2:
left: 276.81
top: 256
width: 13.16
height: 71.34
z index: 1
visible: { card.power_2 != "" or card.toughness_2 != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
...@@ -144,9 +144,9 @@ card style: ...@@ -144,9 +144,9 @@ card style:
visible: visible:
script: styling.cardname_font == "Matrix" script: styling.cardname_font == "Matrix"
casting cost: casting cost:
left: 25 left: 18
top : 55 top : 55
width: 20 width: 27
height: 250 height: 250
alignment: top right alignment: top right
direction: vertical direction: vertical
...@@ -301,17 +301,6 @@ card style: ...@@ -301,17 +301,6 @@ card style:
shadow displacement x: 1 shadow displacement x: 1
shadow displacement y: 1 shadow displacement y: 1
ptsymbols:
left: 25
top: 362
width: 19
height: 103
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
############################# Copyright stuff ############################# Copyright stuff
illustrator: illustrator:
...@@ -340,3 +329,23 @@ card style: ...@@ -340,3 +329,23 @@ card style:
name: MPlantin name: MPlantin
size: 7 size: 7
color: { font_color() } color: { font_color() }
############################################################## Extra card fields
extra card field:
type: choice
name: pt symbols
script: "shieldsword"
extra card style:
pt symbols:
left: 25
top: 362
width: 19
height: 103
z index: 1
visible: { card.power != "" or card.toughness != "" }
render style: image
choice images:
shieldsword: ptshieldsword.png
...@@ -112,11 +112,9 @@ card style: ...@@ -112,11 +112,9 @@ card style:
############################# Name line ############################# Name line
name: name:
left: left: {if card.card_symbol=="none" then 32 else 51}
script: if card.card_symbol=="none" then 32 else 51
top : 30 top : 30
width: width: {if card.card_symbol=="none" then 246 else 227}
script: if card.card_symbol=="none" then 246 else 227
height: 23 height: 23
alignment: bottom shrink-overflow alignment: bottom shrink-overflow
padding bottom: 0 padding bottom: 0
...@@ -171,8 +169,7 @@ card style: ...@@ -171,8 +169,7 @@ card style:
padding top: 0 padding top: 0
card symbol: card symbol:
left: left: {if card.card_symbol=="none" then 20 else 32}
script: if card.card_symbol=="none" then 20 else 32
top : 31 top : 31
height: 20 height: 20
width: 14 width: 14
...@@ -338,30 +335,6 @@ card style: ...@@ -338,30 +335,6 @@ card style:
color: rgb(0,0,0) color: rgb(0,0,0)
separator color: rgb(200,0,0) separator color: rgb(200,0,0)
############################# PT, by Guinea Pig
########### pt box 1 needs to be at 286/124 (captured at 285/123), pt box 2 at 17/342 (captured at 17/342)
pt box:
left: 286
top: 123
width: 70
height: 38
z index: 1
visible:
script: card.pt != ""
render style: image
include file: magic-blends.mse-include/flip-ptboxes
pt box 1b:
left: 17
top: 342
width: 70
height: 38
z index: 2
visible:
script: card.pt_2 != ""
render style: image
include file: magic-blends.mse-include/flip-ptboxes2
############################# Card sorting / numbering ############################# Card sorting / numbering
############################# Copyright stuff ############################# Copyright stuff
...@@ -374,8 +347,7 @@ card style: ...@@ -374,8 +347,7 @@ card style:
font: font:
name: Matrix name: Matrix
size: 12 size: 12
color: color: { font_color() }
script: font_color()
copyright line: copyright line:
left: 26 left: 26
...@@ -386,5 +358,37 @@ card style: ...@@ -386,5 +358,37 @@ card style:
font: font:
name: MPlantin name: MPlantin
size: 8 size: 8
color: color: { font_color() }
script: font_color()
############################################################## Extra card fields
extra card field:
type: choice
name: pt box
script: card.card_color
extra card field:
type: choice
name: pt box 2
script: card.card_color
extra card style:
pt box:
left: 286
top: 123
width: 70
height: 38
z index: 1
visible: { card.pt != "" }
render style: image
include file: magic-blends.mse-include/flip-ptboxes
pt box 2:
left: 17
top: 342
width: 70
height: 38
z index: 2
visible: { card.pt_2 != "" }
render style: image
include file: magic-blends.mse-include/flip-ptboxes2
...@@ -120,11 +120,9 @@ card style: ...@@ -120,11 +120,9 @@ card style:
############################# Name line ############################# Name line
name: name:
left: left: { if card.card_symbol=="none" then 32 else 51 }
script: if card.card_symbol=="none" then 32 else 51
top : 30 top : 30
width: width: { if card.card_symbol=="none" then 246 else 227 }
script: if card.card_symbol=="none" then 246 else 227
height: 23 height: 23
alignment: bottom shrink-overflow alignment: bottom shrink-overflow
padding bottom: 0 padding bottom: 0
...@@ -148,8 +146,7 @@ card style: ...@@ -148,8 +146,7 @@ card style:
z index: 2 z index: 2
padding top: 0 padding top: 0
card symbol: card symbol:
left: left: { if card.card_symbol=="none" then 20 else 32 }
script: if card.card_symbol=="none" then 20 else 32
top : 31 top : 31
height: 20 height: 20
width: 14 width: 14
...@@ -240,18 +237,6 @@ card style: ...@@ -240,18 +237,6 @@ card style:
color: rgb(0,0,0) color: rgb(0,0,0)
separator color: rgb(200,0,0) separator color: rgb(200,0,0)
pt box:
left: 271
top: 461
width: 81
height: 42
z index: 1
visible:
script: card.pt != ""
render style: image
mask: mask_pt.png
include file: magic-blends.mse-include/card-ptboxes
############################# Card sorting / numbering ############################# Card sorting / numbering
############################# Copyright stuff ############################# Copyright stuff
...@@ -276,5 +261,23 @@ card style: ...@@ -276,5 +261,23 @@ card style:
font: font:
name: MPlantin name: MPlantin
size: 8 size: 8
color: color: { font_color() }
script: font_color()
############################################################## Extra card fields
extra card field:
type: choice
name: pt box
script: card.card_color
extra card style:
pt box:
left: 271
top: 461
width: 81
height: 42
z index: 1
visible: { card.pt != "" }
render style: image
mask: mask_pt.png
include file: magic-blends.mse-include/card-ptboxes
...@@ -357,26 +357,6 @@ card style: ...@@ -357,26 +357,6 @@ card style:
color: rgb(0,0,0) color: rgb(0,0,0)
separator color: rgb(200,0,0) separator color: rgb(200,0,0)
pt box:
left: 194
top: 326
width: 56
height: 29
z index: 1
visible: { card.pt != "" }
render style: image
include file: magic-blends.mse-include/card-ptboxes
pt box 2:
left: 445
top: 326
width: 56
height: 29
z index: 1
visible: { card.pt_2 != "" }
render style: image
include file: magic-blends.mse-include/card-ptboxes
############################# Card sorting / numbering ############################# Card sorting / numbering
############################# Copyright stuff ############################# Copyright stuff
...@@ -423,3 +403,36 @@ card style: ...@@ -423,3 +403,36 @@ card style:
name: MPlantin name: MPlantin
size: 6 size: 6
color: { font_color_2() } color: { font_color_2() }
############################################################## Extra card fields
extra card field:
type: choice
name: pt box
script: card.card_color
extra card field:
type: choice
name: pt box 2
script: card.card_color_2
extra card style:
pt box:
left: 194
top: 326
width: 56
height: 29
z index: 1
visible: { card.pt != "" }
render style: image
include file: magic-blends.mse-include/card-ptboxes
pt box 2:
left: 445
top: 326
width: 56
height: 29
z index: 1
visible: { card.pt_2 != "" }
render style: image
include file: magic-blends.mse-include/card-ptboxes
...@@ -92,6 +92,11 @@ styling field: ...@@ -92,6 +92,11 @@ styling field:
choice: modern choice: modern
choice: old choice: old
choice: diagonal T choice: diagonal T
styling field:
type: boolean
name: center short text
description: Center the text on cards with short rule text and no flavor text.
initial: yes
styling style: styling style:
artifact style: artifact style:
...@@ -235,7 +240,13 @@ card style: ...@@ -235,7 +240,13 @@ card style:
then "magic-mana-large" then "magic-mana-large"
else "magic-mana-small" else "magic-mana-small"
size: 14 size: 14
alignment: middle left alignment:
script:
if styling.center_short_text and
not contains(match:"\n", card.rule_text) and
card.flavor_text == "<i-flavor></i-flavor>"
then "middle center"
else "middle left"
z index: 2 z index: 2
padding left: 6 padding left: 6
padding top: 2 padding top: 2
...@@ -269,16 +280,6 @@ card style: ...@@ -269,16 +280,6 @@ card style:
color: rgb(0,0,0) color: rgb(0,0,0)
separator color: rgb(200,0,0) separator color: rgb(200,0,0)
pt box:
left: 271
top: 461
width: 81
height: 42
z index: 1
visible: { card.pt != "" }
render style: image
include file: magic-blends.mse-include/card-ptboxes
############################# Card sorting / numbering ############################# Card sorting / numbering
############################# Copyright stuff ############################# Copyright stuff
...@@ -304,3 +305,21 @@ card style: ...@@ -304,3 +305,21 @@ card style:
name: MPlantin name: MPlantin
size: 6.5 size: 6.5
color: { font_color() } color: { font_color() }
############################################################## Extra card fields
extra card field:
type: choice
name: pt box
script: card.card_color
extra card style:
pt box:
left: 271
top: 461
width: 81
height: 42
z index: 1
visible: { card.pt != "" }
render style: image
include file: magic-blends.mse-include/card-ptboxes
...@@ -245,16 +245,6 @@ card style: ...@@ -245,16 +245,6 @@ card style:
shadow displacement y: 1 shadow displacement y: 1
separator color: rgb(200,0,0) separator color: rgb(200,0,0)
pt box:
left: 271
top: 461
width: 81
height: 42
z index: 1
visible: { card.pt != "" }
render style: image
include file: magic-blends.mse-include/card-ptboxes
############################# Card sorting / numbering ############################# Card sorting / numbering
############################# Copyright stuff ############################# Copyright stuff
...@@ -280,3 +270,21 @@ card style: ...@@ -280,3 +270,21 @@ card style:
name: MPlantin name: MPlantin
size: 6.5 size: 6.5
color: { font_color() } color: { font_color() }
############################################################## Extra card fields
extra card field:
type: choice
name: pt box
script: card.card_color
extra card style:
pt box:
left: 271
top: 461
width: 81
height: 42
z index: 1
visible: { card.pt != "" }
render style: image
include file: magic-blends.mse-include/card-ptboxes
...@@ -720,14 +720,6 @@ card field: ...@@ -720,14 +720,6 @@ card field:
type: text type: text
name: toughness name: toughness
icon: stats/toughness.png icon: stats/toughness.png
#needed for FPM temps
card field:
type: choice
name: ptsymbols
choice: shieldsword
editable: false
save value: false
show statistics: false
card field: card field:
type: text type: text
name: pt name: pt
...@@ -747,15 +739,6 @@ card field: ...@@ -747,15 +739,6 @@ card field:
description: Power/toughness description: Power/toughness
show statistics: false show statistics: false
card field: # box for power/toughness
type: choice
name: pt box
include file: magic-blends.mse-include/card-colors
script: card.card_color
editable: false
save value: false
show statistics: false
############################# Card sorting / numbering ############################# Card sorting / numbering
card field: card field:
type: text type: text
...@@ -920,14 +903,6 @@ card field: ...@@ -920,14 +903,6 @@ card field:
name: toughness 2 name: toughness 2
icon: stats/toughness.png icon: stats/toughness.png
show statistics: false show statistics: false
#needed for FPM temps
card field:
type: choice
name: ptsymbols 2
choice: shieldsword
editable: false
save value: false
show statistics: false
card field: card field:
type: text type: text
name: pt 2 name: pt 2
...@@ -943,23 +918,6 @@ card field: ...@@ -943,23 +918,6 @@ card field:
card list width: 50 card list width: 50
card list name: P/T2 card list name: P/T2
show statistics: false show statistics: false
card field:
type: choice
name: pt box 2
include file: magic-blends.mse-include/card-colors
script: card.card_color_2
editable: false
save value: false
show statistics: false
card field:
# Another pt box witht the same value as pt box 1
type: choice
name: pt box 1b
include file: magic-blends.mse-include/card-colors
script: card.card_color
editable: false
save value: false
show statistics: false
card field: card field:
type: text type: text
name: illustrator 2 name: illustrator 2
......
...@@ -33,15 +33,21 @@ void FontTextElement::getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>& ...@@ -33,15 +33,21 @@ void FontTextElement::getCharInfo(RotatedDC& dc, double scale, vector<CharInfo>&
dc.SetFont(*font, scale); dc.SetFont(*font, scale);
// find sizes & breaks // find sizes & breaks
double prev_width = 0; double prev_width = 0;
size_t line_start = start; // start of the current line
for (size_t i = start ; i < end ; ++i) { for (size_t i = start ; i < end ; ++i) {
Char c = content.GetChar(i - this->start); Char c = content.GetChar(i - this->start);
RealSize s = dc.GetTextExtent(content.substr(start - this->start, i - start + 1)); if (c == _('\n')) {
out.push_back(CharInfo(RealSize(0, dc.GetCharHeight()), break_style));
line_start = i + 1;
prev_width = 0;
} else {
RealSize s = dc.GetTextExtent(content.substr(line_start - this->start, i - line_start + 1));
out.push_back(CharInfo(RealSize(s.width - prev_width, s.height), out.push_back(CharInfo(RealSize(s.width - prev_width, s.height),
c == _('\n') ? break_style :
c == _(' ') ? BREAK_SOFT : BREAK_MAYBE c == _(' ') ? BREAK_SOFT : BREAK_MAYBE
)); ));
prev_width = s.width; prev_width = s.width;
} }
}
} }
double FontTextElement::minScale() const { double FontTextElement::minScale() const {
......
...@@ -44,7 +44,11 @@ class IndexMap : private vector<Value> { ...@@ -44,7 +44,11 @@ class IndexMap : private vector<Value> {
/// Initialize this map with default values given a list of keys /// Initialize this map with default values given a list of keys
/** has no effect if already initialized with the given keys */ /** has no effect if already initialized with the given keys */
bool init(const vector<Key>& keys) { bool init(const vector<Key>& keys) {
if (this->size() == keys.size() && (this->empty() || get_key(this->front()) == keys.front())) return false; if (!this->empty() && (keys.empty() || get_key(this->front()) != keys.front())) {
// switch to different keys
clear();
}
if (this->size() == keys.size()) return false;
this->reserve(keys.size()); this->reserve(keys.size());
for(typename vector<Key>::const_iterator it = keys.begin() ; it != keys.end() ; ++it) { for(typename vector<Key>::const_iterator it = keys.begin() ; it != keys.end() ; ++it) {
const Key& key = *it; const Key& key = *it;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment