mtg_card_maker 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +48 -0
  3. data/LICENSE.txt +59 -14
  4. data/README.md +257 -73
  5. data/lib/mtg_card_maker/base_card.rb +24 -3
  6. data/lib/mtg_card_maker/cli.rb +69 -66
  7. data/lib/mtg_card_maker/color_scheme.rb +18 -23
  8. data/lib/mtg_card_maker/css_service.rb +72 -0
  9. data/lib/mtg_card_maker/fonts/GoudyBookletter1911.ttf +0 -0
  10. data/lib/mtg_card_maker/fonts/OFL.txt +92 -0
  11. data/lib/mtg_card_maker/fonts/goudy_bookletter_base64.txt +1 -0
  12. data/lib/mtg_card_maker/icon_filename_service.rb +118 -0
  13. data/lib/mtg_card_maker/icon_service.rb +87 -25
  14. data/lib/mtg_card_maker/icons/black.svg +6 -1
  15. data/lib/mtg_card_maker/icons/blue.svg +6 -1
  16. data/lib/mtg_card_maker/icons/colorless.svg +6 -1
  17. data/lib/mtg_card_maker/icons/double-digit.svg +6 -0
  18. data/lib/mtg_card_maker/icons/energy.svg +26 -0
  19. data/lib/mtg_card_maker/icons/green.svg +6 -1
  20. data/lib/mtg_card_maker/icons/hybrid/2-black.svg +19 -0
  21. data/lib/mtg_card_maker/icons/hybrid/2-blue.svg +19 -0
  22. data/lib/mtg_card_maker/icons/hybrid/2-green.svg +19 -0
  23. data/lib/mtg_card_maker/icons/hybrid/2-red.svg +19 -0
  24. data/lib/mtg_card_maker/icons/hybrid/2-white.svg +19 -0
  25. data/lib/mtg_card_maker/icons/hybrid/black-blue.svg +19 -0
  26. data/lib/mtg_card_maker/icons/hybrid/black-green.svg +19 -0
  27. data/lib/mtg_card_maker/icons/hybrid/black-red.svg +19 -0
  28. data/lib/mtg_card_maker/icons/hybrid/black-white.svg +19 -0
  29. data/lib/mtg_card_maker/icons/hybrid/blue-black.svg +19 -0
  30. data/lib/mtg_card_maker/icons/hybrid/blue-green.svg +19 -0
  31. data/lib/mtg_card_maker/icons/hybrid/blue-red.svg +19 -0
  32. data/lib/mtg_card_maker/icons/hybrid/blue-white.svg +19 -0
  33. data/lib/mtg_card_maker/icons/hybrid/colorless-black.svg +19 -0
  34. data/lib/mtg_card_maker/icons/hybrid/colorless-blue.svg +19 -0
  35. data/lib/mtg_card_maker/icons/hybrid/colorless-green.svg +19 -0
  36. data/lib/mtg_card_maker/icons/hybrid/colorless-red.svg +19 -0
  37. data/lib/mtg_card_maker/icons/hybrid/colorless-white.svg +19 -0
  38. data/lib/mtg_card_maker/icons/hybrid/green-black.svg +19 -0
  39. data/lib/mtg_card_maker/icons/hybrid/green-blue.svg +19 -0
  40. data/lib/mtg_card_maker/icons/hybrid/green-red.svg +19 -0
  41. data/lib/mtg_card_maker/icons/hybrid/green-white.svg +19 -0
  42. data/lib/mtg_card_maker/icons/hybrid/red-black.svg +19 -0
  43. data/lib/mtg_card_maker/icons/hybrid/red-blue.svg +19 -0
  44. data/lib/mtg_card_maker/icons/hybrid/red-green.svg +19 -0
  45. data/lib/mtg_card_maker/icons/hybrid/red-white.svg +19 -0
  46. data/lib/mtg_card_maker/icons/hybrid/white-black.svg +19 -0
  47. data/lib/mtg_card_maker/icons/hybrid/white-blue.svg +19 -0
  48. data/lib/mtg_card_maker/icons/hybrid/white-green.svg +19 -0
  49. data/lib/mtg_card_maker/icons/hybrid/white-red.svg +19 -0
  50. data/lib/mtg_card_maker/icons/phyrexian/black-blue.svg +19 -0
  51. data/lib/mtg_card_maker/icons/phyrexian/black-green.svg +19 -0
  52. data/lib/mtg_card_maker/icons/phyrexian/black-red.svg +19 -0
  53. data/lib/mtg_card_maker/icons/phyrexian/black-white.svg +19 -0
  54. data/lib/mtg_card_maker/icons/phyrexian/black.svg +6 -0
  55. data/lib/mtg_card_maker/icons/phyrexian/blue-black.svg +19 -0
  56. data/lib/mtg_card_maker/icons/phyrexian/blue-green.svg +19 -0
  57. data/lib/mtg_card_maker/icons/phyrexian/blue-red.svg +19 -0
  58. data/lib/mtg_card_maker/icons/phyrexian/blue-white.svg +19 -0
  59. data/lib/mtg_card_maker/icons/phyrexian/blue.svg +6 -0
  60. data/lib/mtg_card_maker/icons/phyrexian/colorless.svg +6 -0
  61. data/lib/mtg_card_maker/icons/phyrexian/green-black.svg +19 -0
  62. data/lib/mtg_card_maker/icons/phyrexian/green-blue.svg +19 -0
  63. data/lib/mtg_card_maker/icons/phyrexian/green-red.svg +19 -0
  64. data/lib/mtg_card_maker/icons/phyrexian/green-white.svg +19 -0
  65. data/lib/mtg_card_maker/icons/phyrexian/green.svg +6 -0
  66. data/lib/mtg_card_maker/icons/phyrexian/red-black.svg +19 -0
  67. data/lib/mtg_card_maker/icons/phyrexian/red-blue.svg +19 -0
  68. data/lib/mtg_card_maker/icons/phyrexian/red-green.svg +19 -0
  69. data/lib/mtg_card_maker/icons/phyrexian/red-white.svg +19 -0
  70. data/lib/mtg_card_maker/icons/phyrexian/red.svg +6 -0
  71. data/lib/mtg_card_maker/icons/phyrexian/white-black.svg +19 -0
  72. data/lib/mtg_card_maker/icons/phyrexian/white-blue.svg +19 -0
  73. data/lib/mtg_card_maker/icons/phyrexian/white-green.svg +19 -0
  74. data/lib/mtg_card_maker/icons/phyrexian/white-red.svg +19 -0
  75. data/lib/mtg_card_maker/icons/phyrexian/white.svg +6 -0
  76. data/lib/mtg_card_maker/icons/red.svg +6 -1
  77. data/lib/mtg_card_maker/icons/single-digit.svg +6 -0
  78. data/lib/mtg_card_maker/icons/snow.svg +24 -0
  79. data/lib/mtg_card_maker/icons/tap.svg +1 -0
  80. data/lib/mtg_card_maker/icons/tap_legacy.svg +45 -0
  81. data/lib/mtg_card_maker/icons/untap.svg +1 -0
  82. data/lib/mtg_card_maker/icons/white.svg +6 -1
  83. data/lib/mtg_card_maker/icons/x.svg +6 -0
  84. data/lib/mtg_card_maker/layer_config.rb +21 -46
  85. data/lib/mtg_card_maker/layers/border_layer.rb +4 -5
  86. data/lib/mtg_card_maker/layers/frame_layer.rb +1 -1
  87. data/lib/mtg_card_maker/layers/name_layer.rb +16 -8
  88. data/lib/mtg_card_maker/layers/power_layer.rb +1 -3
  89. data/lib/mtg_card_maker/layers/text_box_layer.rb +205 -51
  90. data/lib/mtg_card_maker/layers/type_line_layer.rb +2 -4
  91. data/lib/mtg_card_maker/logger.rb +62 -0
  92. data/lib/mtg_card_maker/mana_cost.rb +59 -128
  93. data/lib/mtg_card_maker/sprite_sheet_assets.rb +10 -55
  94. data/lib/mtg_card_maker/sprite_sheet_builder.rb +20 -8
  95. data/lib/mtg_card_maker/sprite_sheet_service.rb +22 -9
  96. data/lib/mtg_card_maker/svg_gradient_service.rb +11 -11
  97. data/lib/mtg_card_maker/symbol_replacement_service.rb +102 -0
  98. data/lib/mtg_card_maker/text_rendering_service.rb +7 -3
  99. data/lib/mtg_card_maker/version.rb +2 -2
  100. data/lib/mtg_card_maker.rb +9 -78
  101. metadata +79 -12
  102. data/lib/mtg_card_maker/fonts/Goudy Mediaeval DemiBold.ttf +0 -0
  103. data/lib/mtg_card_maker/fonts/goudy_base64.txt +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86af6b0b99b18a80e1c1262b0dee561827cd44bb5c3cda356b80ea82084bb6a5
4
- data.tar.gz: 44666f6b704373a2200ab303605a28681f699bc3d3286ae334a53d08e1d974c8
3
+ metadata.gz: da380956bcd066726ee25156f61eda1ea82071f07a5fa18a10b6eaaf00802351
4
+ data.tar.gz: 3f246516bc68c71485d7edcec625391329a2445b9219f7b79d1e5d28824bb57d
5
5
  SHA512:
6
- metadata.gz: c89f4152f692fcae4517b2ed0ee3905b3ade4d64f066a9604734a80d3fb1d8ea1faae059b8490d672d0c2bf7c278f90887cc4075c548444b02b97e760c9021d3
7
- data.tar.gz: 83a778be41a404a1fa74cf813d8d9d7cc360c370381fb6417e295c790a33139668eb6a89b41573b793ccb7de27b88a6516919b2b2d5a0534d54e1a6a7a659215
6
+ metadata.gz: fe45049d937ba11f0f33c5dc37c663107f50df23a68602ceaa22c1a830a2c151ecda86a272e0bfa32b3f4940332eb1add45a0338f37548d28a4ab13835eea668
7
+ data.tar.gz: f006407754e7a65a85aa6d1eecf52c45e1739174ae95f999d9c3f6d7e9d8b8d5389d628b44a4712df5ba1843dd329e9f5b04cb16fdd8f96c4fa695cef642f4b4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.1] - 2026-10-11
4
+
5
+ ### 🔄 Changed
6
+ - **All card text fields are optional again.** `name`, `type_line`, and `rules_text` may be omitted or blank in the Ruby API, YAML configuration, and CLI, so vanilla creatures, tokens, and blank frames can be generated. 0.2.0 required all three. When `name` or `type_line` is missing, a warning is printed ("Card has no name or type line") and the card is still generated.
7
+ - **The CLI rejects unknown options.** A misspelled option such as `--nmae` now fails with `Unknown switches "--nmae"` and a suggestion, instead of being ignored and producing a blank card.
8
+ - `add_card` uses the key `card` (then `card_1`, `card_2`, ...) when no name is given.
9
+
10
+ ### 🐛 Fixed
11
+ - `generate_sprite` reports `YAML file not found: <path>` for a missing YAML file again, instead of the generic "Failed to generate sprite sheet" error.
12
+
13
+ ## [0.2.0] - 2026-10-11
14
+
15
+ ### 📜 License
16
+ - **Relicensed from CC BY-NC-ND 4.0 to the MIT License.** Version 0.1.0 remains available under its original license.
17
+ - Wizards of the Coast materials and the bundled Goudy Bookletter 1911 font (SIL OFL 1.1) are explicitly excluded from the MIT grant and keep their own terms (see `LICENSE.txt`).
18
+ - Generated cards no longer carry "Some rights reserved"; the footer now reads "MTG Card Maker by Joe Sharp". Cards and their content belong to their creators.
19
+ - Replaced the bundled Goudy Mediaeval DemiBold font, which is licensed for personal use only, with Goudy Bookletter 1911. Embedded card text renders slightly differently, and SVGs with embedded fonts are about 38 KB larger.
20
+
21
+ ### ⚠️ Breaking Changes
22
+ - **Card validation.** The Ruby API and YAML configuration now raise `ArgumentError: Missing required fields` when `name`, `type_line`, or `rules_text` is missing or blank. In 0.1.0 these cards rendered without the missing text. These requirements were removed again in 0.2.1.
23
+ - **Dropped support for Ruby 3.2.** Ruby 3.3 or higher is now required (Ruby 3.2 reached end of life in March 2026).
24
+
25
+ ### ✨ Features
26
+ - **Symbols:** hybrid mana (`{W/U}`, `{2/W}`, `{C/W}`), Phyrexian mana (`{R/P}`, `{W/B/P}`), snow (`{S}`), energy (`{E}`), tap and untap (`{T}`, `{Q}`), `{X}`, and numeric symbols `{0}` through `{99}`, in mana costs and in rules text. Symbols in rules text are rendered inline.
27
+ - **Font embedding option:** `--embed-font` / `--no-embed-font` on the CLI and `embed_font:` in the Ruby API and YAML configuration.
28
+ - **Italic flavor text.**
29
+ - **Quieter, consistent CLI output:** messages go through a new `MtgCardMaker::Logger` (success and info to stdout, warnings and errors to stderr).
30
+ - **viewBox on generated SVGs**, so cards scale correctly when embedded or resized.
31
+ - SVG to WebP conversion script (`bin/svg_to_webp`, experimental, in the source repository only).
32
+
33
+ ### 🔄 Changed
34
+ - **Fonts are embedded by default.** Generated cards now embed the card font as base64 (`embed_font` defaults to `true`; pass `--no-embed-font` or `embed_font: false` to opt out). Single-card SVGs are about 95 KB larger. Sprite sheets embed the font once, and only when a card sets `embed_font: true`.
35
+ - **Generated SVG markup:** the rules text CSS class `card-description` is now `card-rules-text`, and the text box gradient ids `<scheme>_description_gradient` are now `<scheme>_text_box_gradient`. Stylesheets that target the old names need updating.
36
+ - **Public Ruby API renames (affects direct users of these classes):**
37
+ - `ColorScheme#description_gradient_*` → `#text_box_gradient_*`
38
+ - `SvgGradientService.description_gradient_id` / `.define_description_gradient` → `.text_box_gradient_id` / `.define_text_box_gradient`
39
+ - `IconService#available_colors` and `#icon_svg` → `#available_icon_types` and `#symbol_svg`; `IconService::ICON_SETS` → `IconService.icon_sets`
40
+ - `LayerConfig#text_positioning_config` → `#text_box_config`; `#mana_cost_font_size`, `#mana_cost_icon_opacity`, `#mana_cost_text_y_offset`, and `#icon_opacity_config` were removed
41
+ - `ColorScheme.silver` and `ManaCost::COLOR_MAP` were removed
42
+
43
+ ### 🐛 Fixed
44
+ - Snow and energy symbols no longer corrupt the SVG output.
45
+ - Mana costs combining `X` and a number (for example `X3R`) render correctly.
46
+ - An empty YAML file passed to `generate_sprite` now exits with "Failed to generate sprite sheet" instead of `undefined method 'empty?' for nil`.
47
+
48
+ ### 📚 Documentation
49
+ - README updated with hybrid, Phyrexian, snow, energy, tap, and numeric symbol references, and Markdown docs support; YARD documentation refreshed.
50
+
3
51
  ## [0.1.0] - 2025-07-12
4
52
 
5
53
  ### 🎯 Initial Release
data/LICENSE.txt CHANGED
@@ -1,20 +1,65 @@
1
- Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International (CC BY-NC-ND 4.0)
1
+ MIT License
2
2
 
3
- Copyright (c) 2025 joe-sharp
3
+ Copyright (c) 2025 Joe Sharp
4
4
 
5
- This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
6
11
 
7
- You are free to:
8
- Share — copy and redistribute the material in any medium or format
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
9
14
 
10
- The licensor cannot revoke these freedoms as long as you follow the license terms.
11
- Under the following terms:
12
- - Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
13
- - NonCommercial — You may not use the material for commercial purposes.
14
- - NoDerivatives — If you remix, transform, or build upon the material, you may not distribute the modified material.
15
- No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
16
22
 
17
- Notices:
18
- You do not have to comply with the license for elements of the material in the public domain or where your use is permitted by an applicable exception or limitation.
23
+ --------------------------------------------------------------------------------
24
+ Materials NOT covered by the MIT License above
25
+ --------------------------------------------------------------------------------
19
26
 
20
- No warranties are given. The license may not give you all of the permissions necessary for your intended use. For example, other rights such as publicity, privacy, or moral rights may limit how you use the material.
27
+ The MIT License applies only to the original code and original assets created
28
+ by Joe Sharp. The following materials are owned by third parties, are not
29
+ licensed to you by this project, and are excluded from the grant above:
30
+
31
+ 1. Wizards of the Coast materials
32
+
33
+ Magic: The Gathering, its name, mana symbols, set symbols, card frame and
34
+ layout designs, and related marks are property of Wizards of the Coast LLC.
35
+ MTG Card Maker is unofficial Fan Content permitted under the Fan Content
36
+ Policy (https://company.wizards.com/en/legal/fancontentpolicy). It is not
37
+ approved or endorsed by Wizards. Portions of the materials used are
38
+ property of Wizards of the Coast. (c) Wizards of the Coast LLC.
39
+
40
+ Use of these materials, including cards generated with this software, is
41
+ governed by the Fan Content Policy, which does not permit commercial use.
42
+ Nothing in the MIT License grants you any rights in them.
43
+
44
+ 2. Goudy Bookletter 1911 font
45
+
46
+ lib/mtg_card_maker/fonts/GoudyBookletter1911.ttf, its base64 copy
47
+ (goudy_bookletter_base64.txt), and the font as embedded in generated SVG
48
+ files are Copyright (c) 2010, Barry Schwartz (crudfactory.com), licensed
49
+ under the SIL Open Font License, Version 1.1. The license text is in
50
+ lib/mtg_card_maker/fonts/OFL.txt. The font remains under that license,
51
+ not the MIT License.
52
+
53
+ 3. Sample artwork
54
+
55
+ The card artwork and finished sample cards in the images/ directory of the
56
+ source repository (which are not part of the published gem) are
57
+ AI-generated and are included for illustration only. They are not covered
58
+ by the MIT License, and no rights in them are granted.
59
+
60
+ Cards you generate belong to you: the MIT License says nothing about the
61
+ text, artwork, or other content you put on them. The jsharp.svg and
62
+ qrcode.svg icons bundled in lib/mtg_card_maker/icons/ are original to this
63
+ project and are covered by the MIT License.
64
+
65
+ Questions about the author's own original assets: joesharp13@gmail.com