About the GenCard program ------------------------- Usage: GenCard GenCard spoiler_list.txt Input: spoiler_list.txt looks like a standard wizards.com spoiler list, but with additional fields. See below. Output: Creates card images in DPI300/ or DPI150/ or DPI075/ sub-folders. Creates a GenCard.log file indicating any errors. Features in V1.0 ---------------- - Reads and parses spoiler lists from text files: Card Name: Armored Guard Color: White Cost: 2W Type: Creature - Soldier Pow/Tgh: 1/5 Rules Text: T: Remove target attacking creature from combat. Flavor Text: "If you're not on my list, you can't come in." Rarity: U Card Number: 1/45 Artfile: armored_guard.png Artist: Loki Expansion: Invented Rulings: The target creature is no longer considered part of combat. That creature won't deal or receive combat damage. - Generates magic card images in 32-bit-per-pixel PNG format. - Approximate file size: 600KB to 1MB per 300dpi image. - Scales the fonts down until all rules text and flavour text fits. - Generates a warning into the GenCard.log file if fonts get tiny! - Anti-aliases text for a smoother effect. - Handles ordinary mana symbols: - W for white, U for blue, B for black, R for red, G for green. - T for tap, X for X mana symbol (context sensitive!) - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 produce colourless mana symbols. - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 also make single symbols. - Handles split mana symbols (write them as (RW) or (R/W) or R/W). - Handles split-colour cards (e.g. use Color: RedWhite). - Handles various coloured lands (use Color: LandU for 'blue' land, etc). - Coloured lands just have a different coloured rules text box, and a corresponding border around that box. - Split-colour lands are specified by using LandUB, LandBR, etc. - Italicises rules text between matching parentheses ( ... ) - Italicises flavour text - The generated images use transparency to simulate rounded corners. - Generated image filenames use a subset of ASCII, based on card names: - Accented characters lose the accent. - Ligatures like OE and AE are separated. - Most punctuation vanishes, e.g. comma, full-stop, quotes. - Spaces become underscores. - Writes files to 'safe' filenames (safe for Windows). - Writes a log file per run (GenCard.log). New Features in V2.0 -------------------- - There's a new interactive GUI. This lets you browse, then select which card to generate, and choose from several output modes. - 300 DPI, 150 DPI and 75 DPI output resolutions are all supported. The lower resolution modes produce smaller files, suitable for display on a web page. - There's a 9-card mode which generates large images with 9 cards on each. The images are in 300 DPI in the DPI300/ folder, named page-01.png etc. Open one of those images in PhotoShop, set the resolution to 300 DPI, then print it. You'll get a sheet of paper with 9 cards, ready to cut. - There's a 2-card mode which generates 4"x6" photo-sized images. The images are in 300 DPI in the DPI300/ folder, named photo-01.png etc. Copy those images onto a CD or USB stick, take them to your local quick photo store, and you can have cards printed on photo paper in an hour! - Italics can be toggled in both rules text and flavour text by using the tilde character. For example, ~Radiance~ produces an italic word. In the flavour text, ~Zap~ would produce a non-italic word. - Short lines (fewer than 16 letters) in the rules or flavour text are treated as whole paragraphs! This means "Flying, trample" will go onto a line on its own, despite not ending in a full-stop. New Features in V3.0 -------------------- - Flip cards! Indicate a flip card by writing two normal cards separated by a line containing --- or /// (no blank line between the two cards). The cards may have different colours, in which case they are blended vertically. They may even have different art, in which case the art is blended: the first cards' art will be upright on the left, the flipped card's art rotated on the right. If you only supply one art file, it simply fills the artwork box as you'd expect. - Expansion symbols can now be drawn. Use a format like: Expansion: my_rare.gif and place that file into the Symbols/ folder. Use transparent pixels to ensure the symbol is drawn correctly. - The program now draws card backgrounds only from the Base_Sources/ folder, not from Black_Border/ or White_Border/ (you can delete those other folders now if you wish). So, the bevel effects, border, text-box compositing, and two-colour blends all occur at run-time. This reduces the amount of artwork you need to store on your PC, and may support image caching in future. - I changed the SilverCard.png to make it look more like brushed steel. The old swirly card is SilverCard-swirly.png but I no longer use it. - Improved centering algorithm on flavour text. (Was badly off-centre.) - Added 100 DPI output mode. More legible for web pages than 75 DPI. - Better italics font. Has a proper italic 'f' with overhang, etc. This new font's bundled in the EXE, so no special installation required. - New fonts support Microsoft Code Page 1252, which includes proper left and right double quotes, em-dash, en-dash etc. - Newlines now cause a small vertical gap in the rules text. The gap is equal to an extra one fifth of a line height. This produces a clearer separation of two abilities or effects. - The substring " - " become en-dash, while "--" becomes em-dash (which is even longer than en-dash). - Slightly better parsing of X and numbers. Lowercase x as a word becomes plain uppercase X (not a mana symbol). - Better parsing of rarity (handles formats used in existing spoilers). They are all converted to one of R, U or C. Where multiple rarities are given (as in some existing spoilers), the most rare one is used. Special cases: Land becomes C, and Rare 6 becomes U, default is C. - The program now requires about 75MB to run, hovering around 50MB. That's with all the options switched on simultaneously. It also depends, of course, on the size of your artwork files. New Features in V4.0 -------------------- - Split cards! If the Card # field is given, and two cards use the same card number, they become a split card. That is, both are drawn rotated left on the same card. See the Apocalypse set for examples of split cards such as Fire / Ice which appear on the same card. This even works with flip cards, so yes, you could have two flip cards on the same split card (and each could have their own colours, even split-colours!) But that'd be confusing. Split cards should probably only be used for instants or sorceries to avoid introducing too much 'state' into the game. - A split card such as Fire / Ice will be listed by that name in the listbox, but saved to the name Fire_and_Ice.png (since / is not safe to use in a file name). - Artwork/ and Symbols/ are located relative to the spoiler file. So if the spoiler was at ../../spoilers/thing.txt the locations searched for artwork and expansions symbols would be: ../../spoilers/Artwork/ and ../../spoilers/Symbols/ This lets the artwork for each spoiler be close to that spoiler file. - Base_Sources/ is located relative to the executable's location. So if the executable was /games/magic/gencard/GenCard.exe the background art should be located at: /games/magic/gencard/Base_Sources/ This lets you keep WotC spoilers in arbitrary folders, but the Base_Sources are kept with the program. - Expansions can be given as: - a full path name, e.g. Expansion: /magic/symbols/Torment_rare.png - a relative path name, e.g. Expansion: Torment_rare.png (in which case the Symbols/ folder is searched for that file) - a short name, e.g. Expansion: Torment (if using a short name, the card's Rarity provides a 'trailer': R => _rare U => _uncommon C => _common and that 'trailer' is appended, and several image file suffixes .png .jpg .gif are tried in order to locate a valid expansion image file.) - or it can be omitted for any or all cards, in which case the spoiler file name is used to deduce a 'default expansion', e.g. 6th_edition_spoiler.txt will become a default name "6th_edition". This default name is then used to construct expansion symbol names using Rarity 'trailers', as above. - The Card # field is now drawn centered at the bottom of each card. - A mana curve summary is written into the GenCard.log file. - Fixed a bug where a lack of rules text would even prevent flavor text from being displayed. - Fonts: - Enlarged some accents in Magic font (was too small, hard to see). - Added some missing symbols to Magic font (e.g. OE ligature in CP1252). - Slightly better parsing of X and numbers. New Features in V5.0 -------------------- - Rulings files! Each card can have an HTML file describing it generated into the Rulings/ folder. You'll need the Symbols/icons/ folder and its mana symbol image files to view the rulings properly. If you put a Rulings: entry into a card, it will appear in that file. - New (simpler) parsing rules (with some new markup): becomes the name of the card.
becomes a newline (line break). swaps to italic mode from plain mode, and vice-versa. ~ ~ also swaps to italic mode from plain mode, and vice-versa. ( ) become italic, including the parentheses. Words which contain only WUBRGT0123456789X/ become mana symbols. Exception: words which are only numbers or a single X are left plain. Explicit control: [1] or (X) or {R} or (20) or [T] become mana symbols. In fact, [ ] and { } and ( ) all work the same when making mana symbols. New Features in V5.3 -------------------- - Added a new card field, "Save As:" which allows you to supply a filename to use instead of the card's name. For example: Save As: Zaphod You don't need to add the suffix .png - in fact you shouldn't add any suffix, since the same name is used for rulings files, which must end in .html. Parsing Rules ------------- - At least one blank line between cards, please. - Field values may be split over multiple lines. Each continued line must start with a tab or 10+ spaces to be recognised as such. - Lines which end with a full-stop or full-stop then a parenthesis, etc, are treated as distinct paragraphs. See these examples: Card Name: Fliggy Hippo Rules Text: Flying, trample. When Fliggy Hippo leaves play, destroy all 1/1 creatures. Card Name: Magical Bouncy Ball Rules Text: When Magical Bouncy Ball comes into play, return it to its owner's hand. The full-stop/newline combination indicates end-of-paragraph. The comma doesn't. So the latter example's text will be one paragraph, while the former's will be two paragraphs on separate lines. Short lines (less than 16 characters) are treated as a paragraph. For example, "Flying" or "Flying, trample" become separate lines, even despite not ending with a full-stop. - Several formats similar to the above are handled (official spoiler lists should work). Let me know if you find one which doesn't. (Most errors I've seen parsing such files are problems in the text.) - The Artfile, Artist, Expansion, and Rulings fields aren't in WotC files: - Artfile names the file to draw into the card's art area. The largest rectangle with the correct aspect ratio is used. That rectangle is taken from the centre of the image. Or, you may use art of exactly the right pixel size: 570 x 460. Artwork may be in the formats PNG, JPEG or GIF. Suffixes are appended in the above order if you don't give one. Artfiles are searched for in the following places in this order: Inside relative folder Artwork/ Inside relative folder ./ - Artist is the artist's name(s) if known. - Expansion is a filename to use for the expansion symbol. Expansion set symbol files may be in the formats PNG, JPEG or GIF. Suffixes are appended in the above order if you don't give one. Expansion set symbol files are searched for in the following places: Inside relative folder Symbols/ Inside relative folder ./ - Rulings includes a list of rulings for that card. - The tilde character ~ swaps between italic and normal font, in both rules text and flavour text. - "--" become em-dash, " - " becomes en-dash surrounded by spaces. To Do ----- - Basic lands need a large coloured mana symbol in the rules text box. Maybe by looking for large Base_Sources/W.png files not the mana font? - Fonts: - Support Microsoft Code Page 1252 fonts better (CP1252): - Regenerate mana font from new Times font to match symbols size. - Generate an anti-aliased shadow font for Times and Magic. - Add Y- and Z-in-a-circle to the mana font (to support Unglued)? - Write a rulings HTML file per card, or have a ruling search engine? - Parsing improvements: - Use of "Flying" on a single line, or "Flying." not on its own line should both be drawn to their own line. Ditto trample, rampage, etc. Ditto for combinations of those words. - Allow n/a or N/A in any field (should be done, needs testing). - "- Memnarch" on its own line should be right aligned in flavour. - Add an image cache to avoid reloading recent card backgrounds. - Add a "Sort By" menu (by name, color, cost). - Add a "Auto-Number" option (in case the designer can't be bothered to number each card themself). - Show mana symbols in the listbox? - Selectable card backgrounds and fonts? - true M:TG backgrounds with brown artifacts - 8th edition style with Times-font names instead of MagicTG names Anatomy of a Magic Card ----------------------- At 300dpi: A card is 744 pixels wide, 1042 pixels high. This includes the border (white or black). Resolution: 300dpi Artwork: 570 wide by 460 high Textbox: 578 x 306 Mana symbol at top is 36 pixels square. Half of it protrudes rightwards into the right border area! Card name font is 30 pixels from baseline to top of upright. 3 pixels below top card border. Type name is a serif Times font, 24 pixels upright, +7 'y' descender. Textbox font, baseline-to-baseline height is 38 pixels. 27 pixels upright, 7 or 8 'y' descender. Tap/mana symbol 30 pixels square, drops to 3 pixels below baseline. Em-dash is 38 pixels wide. A typical 4"x6" photo at 300 DPI is 1800 x 1200 pixels. This is 6 x 300 = 1800 dots wide, and 4 x 300 = 1200 dots tall. We can thus fit 2 Magic cards onto a photo-sized image. We can also put alignment marks, to aid in cutting. The rectangles are (104, 79, 744, 1042) and (952, 79, 744, 1042).