@@ -53,7 +53,7 @@ def loadCards(fileLoc, deckName):
53
53
return [card for card in allCards if card is not None ]
54
54
55
55
56
- def makeImage (card ):
56
+ def makeImage (card , setSymbol ):
57
57
cardImg , pen = drawUtil .blankCard ()
58
58
59
59
# mana cost TODO cleanup and fix phyrexian
@@ -81,11 +81,14 @@ def makeImage(card):
81
81
nameFont = drawUtil .fitOneLine ("matrixb.ttf" , card .name , xPos - 100 , 60 )
82
82
pen .text ((70 , 85 ), card .name , font = nameFont , fill = "black" , anchor = "lm" )
83
83
84
- # 600 width for typeline, default font 60
84
+ # 600 width for typeline with symbol , default font 60
85
85
typeLine = drawUtil .makeTypeLine (card .supertypes , card .types ,
86
86
card .subtypes )
87
- typeFont = drawUtil .fitOneLine ("matrixb.ttf" , typeLine , 600 , 60 )
88
- pen .text ((70 , 525 ), typeLine , font = typeFont , fill = "black" )
87
+ typeFont = drawUtil .fitOneLine ("matrixb.ttf" , typeLine , 540 , 60 )
88
+ pen .text ((70 , 530 ), typeLine , font = typeFont , fill = "black" , achor = "lm" )
89
+
90
+ if setSymbol is not None :
91
+ cardImg .paste (setSymbol , (620 , 520 ), setSymbol )
89
92
90
93
fmtText , textFont = drawUtil .fitMultiLine ("MPLANTIN.ttf" , card .text , 600 ,
91
94
300 , 40 )
@@ -96,17 +99,22 @@ def makeImage(card):
96
99
outline = "black" ,
97
100
fill = "white" ,
98
101
width = 5 )
99
- ptFont = ImageFont . truetype ( "MPLANTIN.ttf" , 60 )
102
+
100
103
if "Creature" in typeLine :
101
104
# TODO two-digit p/t
102
- pen .text ((570 , 940 ), card .power , font = ptFont , fill = "black" )
103
- pen .text ((600 , 940 ), "/" , font = ptFont , fill = "black" )
104
- pen .text ((615 , 940 ), card .toughness , font = ptFont , fill = "black" )
105
+ pt = "{}/{}" .format (card .power , card .toughness )
106
+ ptFont = drawUtil .fitOneLine ("MPLANTIN.ttf" , pt , 85 , 60 )
107
+ pen .text ((570 , 970 ), pt , font = ptFont , fill = "black" , anchor = "lm" )
108
+
105
109
else :
106
- pen .text ((595 , 940 ), card .loyalty , font = ptFont , fill = "black" )
110
+ loyaltyFont = ImageFont .truetype ("MPLANTIN.ttf" , 60 )
111
+ pen .text ((595 , 940 ), card .loyalty , font = loyaltyFont , fill = "black" )
107
112
108
113
proxyFont = ImageFont .truetype ("matrixb.ttf" , 30 )
109
- pen .text ((70 , 950 ), "BWPROXY 1.2" , font = proxyFont , fill = "black" )
114
+ pen .text ((70 , 950 ),
115
+ "BWPROXY {}" .format (drawUtil .VERSION ),
116
+ font = proxyFont ,
117
+ fill = "black" )
110
118
111
119
brushFont = ImageFont .truetype ("MagicSymbols2008.ttf" , 20 )
112
120
pen .text ((70 , 970 ), "L" , font = brushFont , fill = "black" )
@@ -120,10 +128,12 @@ def makeImage(card):
120
128
if __name__ == "__main__" :
121
129
#print(deckName)
122
130
deckName = sys .argv [1 ].split ("." )[0 ]
131
+ setSymbol = Image .open (sys .argv [2 ]).convert ("RGBA" ).resize (
132
+ (60 , 60 )) if len (sys .argv ) > 2 else None
123
133
124
134
allCards = loadCards (sys .argv [1 ], deckName )
125
135
126
- images = [makeImage (card ) for card in tqdm (allCards )]
136
+ images = [makeImage (card , setSymbol ) for card in tqdm (allCards )]
127
137
128
138
print (images )
129
139
drawUtil .savePages (images , deckName )
0 commit comments