squib 0.6.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +162 -133
  3. data/Gemfile +4 -4
  4. data/README.md +630 -550
  5. data/RELEASE TODO.md +18 -18
  6. data/Rakefile +99 -99
  7. data/lib/squib.rb +32 -32
  8. data/lib/squib/api/background.rb +20 -19
  9. data/lib/squib/api/data.rb +100 -99
  10. data/lib/squib/api/image.rb +90 -76
  11. data/lib/squib/api/save.rb +149 -103
  12. data/lib/squib/api/settings.rb +35 -37
  13. data/lib/squib/api/shapes.rb +230 -228
  14. data/lib/squib/api/text.rb +65 -66
  15. data/lib/squib/api/text_embed.rb +96 -66
  16. data/lib/squib/args/arg_loader.rb +138 -0
  17. data/lib/squib/args/box.rb +55 -0
  18. data/lib/squib/args/card_range.rb +32 -0
  19. data/lib/squib/args/color_validator.rb +12 -0
  20. data/lib/squib/args/coords.rb +33 -0
  21. data/lib/squib/args/dir_validator.rb +16 -0
  22. data/lib/squib/args/draw.rb +92 -0
  23. data/lib/squib/args/embed_adjust.rb +25 -0
  24. data/lib/squib/args/embed_key.rb +17 -0
  25. data/lib/squib/args/hand_special.rb +37 -0
  26. data/lib/squib/args/input_file.rb +37 -0
  27. data/lib/squib/args/paint.rb +44 -0
  28. data/lib/squib/args/paragraph.rb +115 -0
  29. data/lib/squib/args/save_batch.rb +60 -0
  30. data/lib/squib/args/scale_box.rb +53 -0
  31. data/lib/squib/args/sheet.rb +72 -0
  32. data/lib/squib/args/showcase_special.rb +38 -0
  33. data/lib/squib/args/svg_special.rb +37 -0
  34. data/lib/squib/args/transform.rb +25 -0
  35. data/lib/squib/args/typographer.rb +117 -117
  36. data/lib/squib/card.rb +67 -67
  37. data/lib/squib/conf.rb +117 -111
  38. data/lib/squib/constants.rb +178 -178
  39. data/lib/squib/deck.rb +113 -111
  40. data/lib/squib/graphics/cairo_context_wrapper.rb +99 -53
  41. data/lib/squib/graphics/gradient_regex.rb +46 -46
  42. data/lib/squib/graphics/hand.rb +42 -43
  43. data/lib/squib/graphics/image.rb +76 -73
  44. data/lib/squib/graphics/save_doc.rb +103 -137
  45. data/lib/squib/graphics/save_images.rb +33 -33
  46. data/lib/squib/graphics/shapes.rb +119 -152
  47. data/lib/squib/graphics/showcase.rb +85 -88
  48. data/lib/squib/graphics/text.rb +176 -216
  49. data/lib/squib/layout_parser.rb +91 -89
  50. data/lib/squib/layouts/economy.yml +85 -0
  51. data/lib/squib/layouts/fantasy.yml +101 -0
  52. data/lib/squib/layouts/hand.yml +62 -46
  53. data/lib/squib/layouts/playing-card.yml +35 -18
  54. data/lib/squib/project_template/config.yml +45 -40
  55. data/lib/squib/version.rb +10 -10
  56. data/samples/color_shortcuts.rb +6 -0
  57. data/samples/csv_import.rb +18 -18
  58. data/samples/custom-config.yml +5 -5
  59. data/samples/custom_config.rb +18 -18
  60. data/samples/draw_shapes.rb +45 -35
  61. data/samples/embed_text.rb +88 -90
  62. data/samples/hand.rb +24 -24
  63. data/samples/layouts.rb +62 -61
  64. data/samples/layouts_builtin.rb +51 -0
  65. data/samples/load_images.rb +78 -64
  66. data/samples/ranges.rb +64 -53
  67. data/samples/sample.csv +2 -2
  68. data/samples/text_options.rb +102 -94
  69. data/spec/api/api_data_spec.rb +57 -50
  70. data/spec/api/api_settings_spec.rb +37 -17
  71. data/spec/args/box_spec.rb +127 -0
  72. data/spec/args/draw_spec.rb +95 -0
  73. data/spec/args/embed_key_spec.rb +13 -0
  74. data/spec/args/input_file_spec.rb +21 -0
  75. data/spec/args/paint_spec.rb +22 -0
  76. data/spec/args/paragraph_spec.rb +153 -0
  77. data/spec/args/range_spec.rb +36 -0
  78. data/spec/args/save_batch_spec.rb +51 -0
  79. data/spec/args/scale_box_spec.rb +71 -0
  80. data/spec/args/sheet_spec.rb +58 -0
  81. data/spec/args/showcase_special_spec.rb +15 -0
  82. data/spec/data/samples/autoscale_font.rb.txt +84 -87
  83. data/spec/data/samples/basic.rb.txt +209 -203
  84. data/spec/data/samples/cairo_access.rb.txt +2 -2
  85. data/spec/data/samples/config_text_markup.rb.txt +72 -75
  86. data/spec/data/samples/csv_import.rb.txt +76 -80
  87. data/spec/data/samples/custom_config.rb.txt +48 -49
  88. data/spec/data/samples/draw_shapes.rb.txt +100 -42
  89. data/spec/data/samples/embed_text.rb.txt +283 -295
  90. data/spec/data/samples/excel.rb.txt +162 -171
  91. data/spec/data/samples/gradients.rb.txt +79 -67
  92. data/spec/data/samples/hand.rb.txt +538 -514
  93. data/spec/data/samples/hello_world.rb.txt +36 -38
  94. data/spec/data/samples/load_images.rb.txt +41 -5
  95. data/spec/data/samples/portrait-landscape.rb.txt +49 -51
  96. data/spec/data/samples/ranges.rb.txt +460 -429
  97. data/spec/data/samples/saves.rb.txt +801 -785
  98. data/spec/data/samples/showcase.rb.txt +5910 -5906
  99. data/spec/data/samples/text_options.rb.txt +1125 -981
  100. data/spec/data/samples/tgc_proofs.rb.txt +81 -79
  101. data/spec/data/samples/units.rb.txt +18 -12
  102. data/spec/data/xlsx/with_macros.xlsm +0 -0
  103. data/spec/graphics/cairo_context_wrapper_spec.rb +84 -75
  104. data/spec/graphics/graphics_images_spec.rb +94 -85
  105. data/spec/graphics/graphics_save_doc_spec.rb +67 -65
  106. data/spec/samples/expected/hand.png +0 -0
  107. data/spec/samples/expected/hand_pretty.png +0 -0
  108. data/spec/samples/expected/layout_00.png +0 -0
  109. data/spec/samples/expected/load_images_00.png +0 -0
  110. data/spec/samples/expected/ranges_00.png +0 -0
  111. data/spec/samples/expected/shape_00.png +0 -0
  112. data/spec/samples/expected/showcase.png +0 -0
  113. data/spec/samples/expected/showcase2.png +0 -0
  114. data/spec/samples/expected/showcase_individual_00.png +0 -0
  115. data/spec/samples/expected/showcase_individual_01.png +0 -0
  116. data/spec/samples/expected/showcase_individual_02.png +0 -0
  117. data/spec/samples/expected/showcase_individual_03.png +0 -0
  118. data/spec/samples/expected/text_00.png +0 -0
  119. data/spec/samples/expected/text_01.png +0 -0
  120. data/spec/samples/expected/text_02.png +0 -0
  121. data/spec/samples/samples_regression_spec.rb +82 -82
  122. data/spec/spec_helper.rb +3 -2
  123. data/squib.gemspec +48 -48
  124. data/squib.sublime-project +42 -36
  125. metadata +61 -33
  126. data/lib/squib/input_helpers.rb +0 -238
  127. data/spec/api/api_image_spec.rb +0 -38
  128. data/spec/api/api_text_spec.rb +0 -37
  129. data/spec/graphics/graphics_shapes_spec.rb +0 -85
  130. data/spec/graphics/graphics_text_spec.rb +0 -164
  131. data/spec/input_helpers_spec.rb +0 -238
  132. data/spec/samples/expected/embed_multi_00.png +0 -0
  133. data/spec/samples/expected/embed_multi_01.png +0 -0
  134. data/spec/samples/expected/embed_multi_02.png +0 -0
  135. data/spec/samples/expected/ranges_01.png +0 -0
  136. data/spec/samples/expected/ranges_02.png +0 -0
@@ -1,76 +1,90 @@
1
- module Squib
2
- class Deck
3
-
4
- # Renders a png file at the given location.
5
- #
6
- # See {file:samples/image.rb samples/image.rb} and {file:samples/tgc-overlay.rb samples/tgc-overlay.rb} as examples.
7
- # @example
8
- # png file: 'img.png', x: 50, y: 50
9
- #
10
- # @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
11
- # @option opts file [String] ((empty)) file(s) to read in. If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done. See {file:README.md#Specifying_Files Specifying Files}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
12
- # @option opts x [Integer] (0) the x-coordinate to place. Supports Arrays, see {file:README#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
13
- # @option opts y [Integer] (0) the y-coordinate to place. Supports Arrays, see {file:README#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
14
- # @option opts width [Integer] (:native) the pixel width that the image should scale to. Scaling PNGs is not recommended for professional-looking cards. When set to `:native`, uses the DPI and units of the loaded SVG document. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
15
- # @option opts height [Integer] (:native) the pixel width that the image should scale to. Scaling PNGs is not recommended for professional-looking cards. When set to `:native`, uses the DPI and units of the loaded SVG document. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
16
- # @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
17
- # @option opts alpha [Decimal] (1.0) the alpha-transparency percentage used to blend this image. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
18
- # @option opts blend [:none, :multiply, :screen, :overlay, :darken, :lighten, :color_dodge, :color_burn, :hard_light, :soft_light, :difference, :exclusion, :hsl_hue, :hsl_saturation, :hsl_color, :hsl_luminosity] (:none) the composite blend operator used when applying this image. See Blend Modes at http://cairographics.org/operators. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
19
- # @option opts angle [FixNum] (0) Rotation of the in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
20
- # @option opts mask [String] (nil) If specified, the image will be used as a mask for the given color/gradient. Transparent pixels are ignored, opaque pixels are the given color. Note: the origin for gradient coordinates is at the given x,y, not at 0,0 as it is most other places.
21
- # @return [nil] Returns nil
22
- # @api public
23
- def png(opts = {})
24
- opts = needs(opts, [:range, :files, :x, :y, :width, :height, :alpha, :layout, :blend, :angle, :mask])
25
- Dir.chdir(img_dir) do
26
- @progress_bar.start('Loading PNG(s)', opts[:range].size) do |bar|
27
- opts[:range].each do |i|
28
- @cards[i].png(opts[:file][i],
29
- opts[:x][i], opts[:y][i], opts[:width][i], opts[:height][i],
30
- opts[:alpha][i], opts[:blend][i], opts[:angle][i], opts[:mask][i])
31
- bar.increment
32
- end
33
- end
34
- end
35
- end
36
-
37
- # Renders an entire svg file at the given location. Uses the SVG-specified units and DPI to determine the pixel width and height. If neither data nor file are specified for a given card, this method does nothing.
38
- #
39
- # See {file:samples/load-images.rb samples/load-images.rb} and {file:samples/tgc-overlay.rb samples/tgc-overlay.rb} as examples.
40
- # @example
41
- # svg 1..2, 'icon.svg', '#stone', x: 50, y:50
42
- #
43
- # @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
44
- # @option opts file [String] ('') file(s) to read in. If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done. See {file:README.md#Specifying_Files Specifying Files}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
45
- # @option opts data [String] (nil) render from an SVG XML string. Overrides file if both are specified (a warning is shown) . If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done. See {file:README.md#Specifying_Files Specifying Files}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}.
46
- # @option opts id [String] (nil) if set, then only render the SVG element with the given id. Prefix '#' is optional. Note: the x-y coordinates are still relative to the SVG document's page. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
47
- # @option opts force_id [Boolean] (false) if set, then this svg will not be rendered at all if the id is empty or nil. If not set, the entire SVG is rendered. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
48
- # @option opts x [Integer] (0) the x-coordinate to place. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
49
- # @option opts y [Integer] (0) the y-coordinate to place. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
50
- # @option opts width [Integer] (:native) the pixel width that the image should scale to. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
51
- # @option opts height [Integer] (:native) the pixel width that the image should scale to. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
52
- # @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
53
- # @option opts alpha [Decimal] (1.0) the alpha-transparency percentage used to blend this image. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
54
- # @option opts blend [:none, :multiply, :screen, :overlay, :darken, :lighten, :color_dodge, :color_burn, :hard_light, :soft_light, :difference, :exclusion, :hsl_hue, :hsl_saturation, :hsl_color, :hsl_luminosity] (:none) the composite blend operator used when applying this image. See Blend Modes at http://cairographics.org/operators. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
55
- # @option opts angle [FixNum] (0) Rotation of the in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
56
- # @option opts mask [String] (nil) If specified, the image will be used as a mask for the given color/gradient. Transparent pixels are ignored, opaque pixels are the given color. Note: the origin for gradient coordinates is at the given x,y, not at 0,0 as it is most other places.
57
- # @return [nil] Returns nil
58
- # @api public
59
- def svg(opts = {})
60
- p = needs(opts,[:range, :files, :svgdata, :svgid, :force_svgid, :x, :y, :width, :height,
61
- :layout, :alpha, :blend, :angle, :mask])
62
- Dir.chdir(img_dir) do
63
- @progress_bar.start('Loading SVG(s)', p[:range].size) do |bar|
64
- p[:range].each do |i|
65
- unless p[:force_id][i] && p[:id][i].to_s.empty?
66
- @cards[i].svg(p[:file][i], p[:data][i], p[:id][i], p[:x][i], p[:y][i],
67
- p[:width][i], p[:height][i], p[:alpha][i], p[:blend][i], p[:angle][i],p[:mask][i])
68
- end
69
- bar.increment
70
- end
71
- end
72
- end
73
- end
74
-
75
- end
76
- end
1
+ require 'squib/args/card_range'
2
+ require 'squib/args/paint'
3
+ require 'squib/args/scale_box'
4
+ require 'squib/args/transform'
5
+ require 'squib/args/input_file'
6
+ require 'squib/args/svg_special'
7
+
8
+ module Squib
9
+ class Deck
10
+
11
+ # Renders a png file at the given location.
12
+ #
13
+ # See {file:samples/image.rb samples/image.rb} and {file:samples/tgc-overlay.rb samples/tgc-overlay.rb} as examples.
14
+ # @example
15
+ # png file: 'img.png', x: 50, y: 50
16
+ #
17
+ # @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
18
+ # @option opts file [String] ((empty)) file(s) to read in. If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done. See {file:README.md#Specifying_Files Specifying Files}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
19
+ # @option opts x [Integer] (0) the x-coordinate to place. Supports Arrays, see {file:README#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
20
+ # @option opts y [Integer] (0) the y-coordinate to place. Supports Arrays, see {file:README#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
21
+ # @option opts width [Integer, :native, :scale, :deck] (:native) the pixel width that the image should scale to. :deck will scale to the deck width. :scale will use the height to scale and keep native the aspect ratio. Scaling PNGs is not recommended for professional-looking cards. When set to `:native`, uses the DPI and units of the loaded SVG document. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
22
+ # @option opts height [Integer, :native, :scale, :deck] (:native) the pixel width that the image should scale to. :deck will scale to the deck height. :scale will use the width to scale and keep native the aspect ratio. Scaling PNGs is not recommended for professional-looking cards. When set to `:native`, uses the DPI and units of the loaded SVG document. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
23
+ # @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
24
+ # @option opts alpha [Decimal] (1.0) the alpha-transparency percentage used to blend this image. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
25
+ # @option opts blend [:none, :multiply, :screen, :overlay, :darken, :lighten, :color_dodge, :color_burn, :hard_light, :soft_light, :difference, :exclusion, :hsl_hue, :hsl_saturation, :hsl_color, :hsl_luminosity] (:none) the composite blend operator used when applying this image. See Blend Modes at http://cairographics.org/operators. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
26
+ # @option opts angle [FixNum] (0) Rotation of the in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
27
+ # @option opts mask [String] (nil) If specified, the image will be used as a mask for the given color/gradient. Transparent pixels are ignored, opaque pixels are the given color. Note: the origin for gradient coordinates is at the given x,y, not at 0,0 as it is most other places.
28
+ # @return [nil] Returns nil
29
+ # @api public
30
+ def png(opts = {})
31
+ Dir.chdir(img_dir) do
32
+ range = Args::CardRange.new(opts[:range], deck_size: size)
33
+ paint = Args::Paint.new(custom_colors).load!(opts, expand_by: size, layout: layout)
34
+ box = Args::ScaleBox.new(self).load!(opts, expand_by: size, layout: layout, dpi: dpi)
35
+ trans = Args::Transform.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
36
+ ifile = Args::InputFile.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
37
+ @progress_bar.start('Loading PNG(s)', range.size) do |bar|
38
+ range.each do |i|
39
+ @cards[i].png(ifile[i].file, box[i], paint[i], trans[i])
40
+ bar.increment
41
+ end
42
+ end
43
+ end
44
+ end
45
+
46
+ # Renders an entire svg file at the given location. Uses the SVG-specified units and DPI to determine the pixel width and height. If neither data nor file are specified for a given card, this method does nothing.
47
+ #
48
+ # See {file:samples/load-images.rb samples/load-images.rb} and {file:samples/tgc-overlay.rb samples/tgc-overlay.rb} as examples.
49
+ #
50
+ # Note: if alpha transparency is desired, set that in the SVG.
51
+ #
52
+ # @example
53
+ # svg range: 1..2, file: 'icon.svg', id: '#stone', x: 50, y:50
54
+ #
55
+ # @option opts range [Enumerable, :all] (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
56
+ # @option opts file [String] ('') file(s) to read in. If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done. See {file:README.md#Specifying_Files Specifying Files}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
57
+ # @option opts data [String] (nil) render from an SVG XML string. Overrides file if both are specified (a warning is shown) . If it's a single file, then it's use for every card in range. If the parameter is an Array of files, then each file is looked up for each card. If any of them are nil or '', nothing is done. See {file:README.md#Specifying_Files Specifying Files}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}.
58
+ # @option opts id [String] (nil) if set, then only render the SVG element with the given id. Prefix '#' is optional. Note: the x-y coordinates are still relative to the SVG document's page. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
59
+ # @option opts force_id [Boolean] (false) if set, then this svg will not be rendered at all if the id is empty or nil. If not set, the entire SVG is rendered. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
60
+ # @option opts x [Integer] (0) the x-coordinate to place. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
61
+ # @option opts y [Integer] (0) the y-coordinate to place. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
62
+ # @option opts width [Integer] (:native) the pixel width that the image should scale to. :deck will scale to the deck height. :scale will use the width to scale and keep native the aspect ratio. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
63
+ # @option opts height [Integer] (:native) the pixel width that the image should scale to. :deck will scale to the deck height. :scale will use the width to scale and keep native the aspect ratio. SVG scaling is done with vectors, so the scaling should be smooth. When set to `:native`, uses the DPI and units of the loaded SVG document. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}. Supports Unit Conversion, see {file:README.md#Units Units}.
64
+ # @option opts layout [String, Symbol] (nil) entry in the layout to use as defaults for this command. See {file:README.md#Custom_Layouts Custom Layouts}. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
65
+ # @option opts blend [:none, :multiply, :screen, :overlay, :darken, :lighten, :color_dodge, :color_burn, :hard_light, :soft_light, :difference, :exclusion, :hsl_hue, :hsl_saturation, :hsl_color, :hsl_luminosity] (:none) the composite blend operator used when applying this image. See Blend Modes at http://cairographics.org/operators. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
66
+ # @option opts angle [FixNum] (0) Rotation of the in radians. Note that this rotates around the upper-left corner, making the placement of x-y coordinates slightly tricky. Supports Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
67
+ # @option opts mask [String] (nil) If specified, the image will be used as a mask for the given color/gradient. Transparent pixels are ignored, opaque pixels are the given color. Note: the origin for gradient coordinates is at the given x,y, not at 0,0 as it is most other places.
68
+ # @return [nil] Returns nil
69
+ # @api public
70
+ def svg(opts = {})
71
+ Dir.chdir(img_dir) do
72
+ range = Args::CardRange.new(opts[:range], deck_size: size)
73
+ paint = Args::Paint.new(custom_colors).load!(opts, expand_by: size, layout: layout)
74
+ box = Args::ScaleBox.new(self).load!(opts, expand_by: size, layout: layout, dpi: dpi)
75
+ trans = Args::Transform.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
76
+ ifile = Args::InputFile.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
77
+ svg_args = Args::SvgSpecial.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
78
+ @progress_bar.start('Loading SVG(s)', range.size) do |bar|
79
+ range.each do |i|
80
+ if svg_args.render?(i)
81
+ @cards[i].svg(ifile[i].file, svg_args[i], box[i], paint[i], trans[i])
82
+ end
83
+ bar.increment
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ end
90
+ end
@@ -1,103 +1,149 @@
1
- module Squib
2
- class Deck
3
-
4
- # Saves the given range of cards to either PNG or PDF
5
- #
6
- # @option opts [Enumerable] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
7
- # @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
8
- # @option opts [Symbol] format (:png) the format that this will be rendered too. Options `:pdf, :png`. Array of both is allowed: `[:pdf, :png]`
9
- # @option opts [String] prefix (card_) the prefix of the file name to be printed
10
- # @option opts [Boolean] rotate (false) PNG saving only. If true, the saved cards will be rotated 90 degrees clockwise. Intended to rendering landscape instead of portrait.
11
- # @return self
12
- # @api public
13
- def save(opts = {})
14
- # opts = needs(opts, [:range, :creatable_dir, :formats, :prefix, :rotate])
15
- save_png(opts) if Array(opts[:format]).include? :png
16
- save_pdf(opts) if Array(opts[:format]).include? :pdf
17
- self
18
- end
19
-
20
- # Saves the given range of cards to a PNG
21
- #
22
- # @example
23
- # save range: 1..8, dir: '_pnp', prefix: 'bw_'
24
- #
25
- # @option opts [Enumerable] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
26
- # @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
27
- # @option opts [String] prefix (card_) the prefix of the file name to be printed.
28
- # @option opts [String] count_format (%02d) the format string used for formatting the card count (e.g. padding zeros). Uses a Ruby format string (see the Ruby doc for Kernel::sprintf for specifics)
29
- # @option opts [Boolean, :clockwise, :counterclockwise] rotate (false) if true, the saved cards will be rotated 90 degrees clockwise. Or, rotate by the number of radians. Intended to rendering landscape instead of portrait.
30
- # @return [nil] Returns nothing
31
- # @api public
32
- def save_png(opts = {})
33
- opts = needs(opts,[:range, :creatable_dir, :prefix, :count_format, :rotate])
34
- @progress_bar.start("Saving PNGs to #{opts[:dir]}/#{opts[:prefix]}*", @cards.size) do |bar|
35
- opts[:range].each do |i|
36
- @cards[i].save_png(i, opts[:dir], opts[:prefix], opts[:count_format], opts[:rotate], opts[:angle])
37
- bar.increment
38
- end
39
- end
40
- end
41
-
42
- # Renders a range of cards in a showcase as if they are sitting in 3D on a reflective surface
43
- # See {file:samples/showcase.rb} for full example
44
- #
45
- # @example
46
- # showcase file: 'showcase_output.png', trim: 78, trim_radius: 32
47
- #
48
- # @option opts [Enumerable, :all] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
49
- # @option opts [Fixnum] trim (0) the margin around the card to trim before putting into the showcase
50
- # @option opts [Fixnum] trim_radius (38) the rounded rectangle radius around the card to trim before putting into the showcase
51
- # @option opts [Fixnum] margin (75) the margin around the entire showcase
52
- # @option opts [Fixnum] scale (0.8) percentage of original width of each (trimmed) card to scale to. Must be between 0.0 and 1.0, but starts looking bad around 0.6.
53
- # @option opts [Fixnum] offset (1.1) percentage of the scaled width of each card to shift each offset. e.g. 1.1 is a 10% shift, and 0.95 is overlapping by 5%
54
- # @option opts [String, Color] fill_color (:white) backdrop color. Usually black or white. Supports gradients.
55
- # @option opts [Fixnum] reflect_offset (15) the number of pixels between the bottom of the card and the reflection
56
- # @option opts [Fixnum] reflect_strength (0.2) the starting alpha transparency of the reflection (at the top of the card). Percentage between 0 and 1. Looks more realistic at low values since even shiny surfaces lose a lot of light.
57
- # @option opts [Fixnum] reflect_percent (0.25) the length of the reflection in percentage of the card. Larger values tend to make the reflection draw just as much attention as the card, which is not good.
58
- # @option opts [:left, :right] face (:left) which direction the cards face. Anything but `:right` will face left
59
- # @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
60
- # @option opts [String] file ('showcase.png') the file to save in dir. Will be overwritten.
61
- # @return [nil] Returns nothing.
62
- # @api public
63
- def showcase(opts = {})
64
- opts = {file: 'showcase.png', fill_color: :white}.merge(opts)
65
- opts = needs(opts,[:range, :margin, :trim, :trim_radius, :creatable_dir, :file_to_save, :face])
66
- render_showcase(opts[:range], opts[:trim], opts[:trim_radius],
67
- opts[:scale], opts[:offset], opts[:fill_color],
68
- opts[:reflect_offset], opts[:reflect_percent], opts[:reflect_strength],
69
- opts[:margin], opts[:face],
70
- opts[:dir], opts[:file])
71
- end
72
-
73
- # Renders a range of cards fanned out as if in a hand. Saves as PNG.
74
- # See {file:samples/hand.rb} for full example
75
- #
76
- # @example
77
- # hand range: :all, radius: :auto, margin: 20, fill_color: :white,
78
- # angle_range: (Math::PI / -4.0)..(Math::PI / 2),
79
- # dir: '_output', file: 'hand1.png'
80
- #
81
- # @option opts [Enumerable, :all] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
82
- # @option opts [Fixnum] radius (:auto) the distance from the bottom of each card to the center of the fan. If set to `:auto`, then it is computed as 30% of the card's height.
83
- # @option opts [Range] angle_range: ((Math::PI / -4.0)..(Math::PI / 2)). The overall width of the fan, in radians. Angle of zero is a vertical card. Further negative angles widen the fan counter-clockwise and positive angles widen the fan clockwise.
84
- # @option opts [Fixnum] trim (0) the margin around the card to trim before putting into the image
85
- # @option opts [Fixnum] trim_radius (0) the rounded rectangle radius around the card to trim before putting into the showcase
86
- # @option opts [Fixnum] margin (75) the margin around the entire image
87
- # @option opts [String, Color] fill_color (:white) backdrop color. Usually black or white. Supports gradients.
88
- # @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
89
- # @option opts [String] file ('hand.png') the file to save in dir. Will be overwritten.
90
- # @return [nil] Returns nothing.
91
- # @api public
92
- def hand(opts = {})
93
- opts = {file: 'hand.png', fill_color: :white, radius: :auto, trim_radius: 0}
94
- .merge(opts)
95
- opts = needs(opts,[:range, :margin, :trim, :trim_radius, :creatable_dir, :file_to_save])
96
- opts[:radius] = 0.3 * height if opts[:radius] == :auto
97
- render_hand(opts[:range], opts[:radius], opts[:angle_range],
98
- opts[:trim], opts[:trim_radius], opts[:margin],
99
- opts[:fill_color], opts[:dir], opts[:file])
100
- end
101
-
102
- end
103
- end
1
+ require 'squib/args/card_range'
2
+ require 'squib/args/hand_special'
3
+ require 'squib/args/save_batch'
4
+ require 'squib/args/sheet'
5
+ require 'squib/args/showcase_special'
6
+
7
+ module Squib
8
+ class Deck
9
+
10
+ # Saves the given range of cards to either PNG or PDF
11
+ #
12
+ #
13
+ # @option opts [Enumerable] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
14
+ # @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
15
+ # @option opts [Symbol] format (:png) the format that this will be rendered too. Options `:pdf, :png`. Array of both is allowed: `[:pdf, :png]`
16
+ # @option opts [String] prefix (card_) the prefix of the file name to be printed
17
+ # @option opts [Boolean] rotate (false) PNG saving only. If true, the saved cards will be rotated 90 degrees clockwise. Intended to rendering landscape instead of portrait.
18
+ # @return self
19
+ # @api public
20
+ def save(opts = {})
21
+ save_png(opts) if Array(opts[:format]).include? :png
22
+ save_pdf(opts) if Array(opts[:format]).include? :pdf
23
+ self
24
+ end
25
+
26
+ # Lays out the cards in range and renders a PDF
27
+ #
28
+ # @example
29
+ # save_pdf file: 'deck.pdf', margin: 75, gap: 5, trim: 37
30
+ #
31
+ # @option opts file [String] the name of the PDF file to save. See {file:README.md#Specifying_Files Specifying Files}
32
+ # @option opts dir [String] (_output) the directory to save to. Created if it doesn't exist.
33
+ # @option opts width [Integer] (3300) the height of the page in pixels. Default is 11in * 300dpi. Supports unit conversion.
34
+ # @option opts height [Integer] (2550) the height of the page in pixels. Default is 8.5in * 300dpi. Supports unit conversion.
35
+ # @option opts margin [Integer] (75) the margin around the outside of the page. Supports unit conversion.
36
+ # @option opts gap [Integer] (0) the space in pixels between the cards. Supports unit conversion.
37
+ # @option opts trim [Integer] (0) the space around the edge of each card to trim (e.g. to cut off the bleed margin for print-and-play). Supports unit conversion.
38
+ # @return [nil]
39
+ # @api public
40
+ def save_pdf(opts = {})
41
+ range = Args::CardRange.new(opts[:range], deck_size: size)
42
+ sheet = Args::Sheet.new(custom_colors, {file: 'output.pdf'}).load!(opts, expand_by: size, layout: layout, dpi: dpi)
43
+ render_pdf(range, sheet)
44
+ end
45
+
46
+ # Saves the given range of cards to a PNG
47
+ #
48
+ # @example
49
+ # save range: 1..8, dir: '_pnp', prefix: 'bw_'
50
+ #
51
+ # Options support Arrays, see {file:README.md#Arrays_and_Singleton_Expansion Arrays and Singleon Expansion}
52
+ #
53
+ # @option opts [Enumerable] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
54
+ # @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
55
+ # @option opts [String] prefix (card_) the prefix of the file name to be printed.
56
+ # @option opts [String] count_format (%02d) the format string used for formatting the card count (e.g. padding zeros). Uses a Ruby format string (see the Ruby doc for Kernel::sprintf for specifics)
57
+ # @option opts [Boolean, :clockwise, :counterclockwise] rotate (false) if true, the saved cards will be rotated 90 degrees clockwise. Or, rotate by the number of radians. Intended to rendering landscape instead of portrait.
58
+ # @return [nil] Returns nothing
59
+ # @api public
60
+ def save_png(opts = {})
61
+ range = Args::CardRange.new(opts[:range], deck_size: size)
62
+ batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
63
+ @progress_bar.start("Saving PNGs to #{batch.summary}", size) do |bar|
64
+ range.each do |i|
65
+ @cards[i].save_png(batch[i])
66
+ bar.increment
67
+ end
68
+ end
69
+ end
70
+
71
+ # Lays out the cards in range and renders a stitched PNG sheet
72
+ #
73
+ # @example
74
+ # save_sheet prefix: 'sheet_', margin: 75, gap: 5, trim: 37
75
+ #
76
+ # @option opts [Enumerable] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
77
+ # @option opts columns [Integer] (5) the number of columns in the grid. Must be an integer
78
+ # @option opts rows [Integer] (:infinite) the number of rows in the grid. When set to :infinite, the sheet scales to the rows needed. If there are more cards than rows*columns, new sheets are started.
79
+ # @option opts [String] prefix (card_) the prefix of the file name(s)
80
+ # @option opts [String] count_format (%02d) the format string used for formatting the card count (e.g. padding zeros). Uses a Ruby format string (see the Ruby doc for Kernel::sprintf for specifics)
81
+ # @option opts dir [String] (_output) the directory to save to. Created if it doesn't exist.
82
+ # @option opts margin [Integer] (0) the margin around the outside of the sheet.
83
+ # @option opts gap [Integer] (0) the space in pixels between the cards
84
+ # @option opts trim [Integer] (0) the space around the edge of each card to trim (e.g. to cut off the bleed margin for print-and-play)
85
+ # @return [nil]
86
+ # @api public
87
+ def save_sheet(opts = {})
88
+ range = Args::CardRange.new(opts[:range], deck_size: size)
89
+ batch = Args::SaveBatch.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
90
+ sheet = Args::Sheet.new(custom_colors, {margin: 0}, size).load!(opts, expand_by: size, layout: layout, dpi: dpi)
91
+ render_sheet(range, batch, sheet)
92
+ end
93
+
94
+ # Renders a range of cards in a showcase as if they are sitting in 3D on a reflective surface
95
+ # See {file:samples/showcase.rb} for full example
96
+ #
97
+ # @example
98
+ # showcase file: 'showcase_output.png', trim: 78, trim_radius: 32
99
+ #
100
+ # @option opts [Enumerable, :all] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
101
+ # @option opts [Fixnum] trim (0) the margin around the card to trim before putting into the showcase
102
+ # @option opts [Fixnum] trim_radius (38) the rounded rectangle radius around the card to trim before putting into the showcase
103
+ # @option opts [Fixnum] margin (75) the margin around the entire showcase
104
+ # @option opts [Fixnum] scale (0.8) percentage of original width of each (trimmed) card to scale to. Must be between 0.0 and 1.0, but starts looking bad around 0.6.
105
+ # @option opts [Fixnum] offset (1.1) percentage of the scaled width of each card to shift each offset. e.g. 1.1 is a 10% shift, and 0.95 is overlapping by 5%
106
+ # @option opts [String, Color] fill_color (:white) backdrop color. Usually black or white. Supports gradients.
107
+ # @option opts [Fixnum] reflect_offset (15) the number of pixels between the bottom of the card and the reflection. Supports Unit Conversion, see {file:README.md#Units Units}.
108
+ # @option opts [Fixnum] reflect_strength (0.2) the starting alpha transparency of the reflection (at the top of the card). Percentage between 0 and 1. Looks more realistic at low values since even shiny surfaces lose a lot of light.
109
+ # @option opts [Fixnum] reflect_percent (0.25) the length of the reflection in percentage of the card. Larger values tend to make the reflection draw just as much attention as the card, which is not good.
110
+ # @option opts [:left, :right] face (:left) which direction the cards face. Anything but `:right` will face left
111
+ # @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
112
+ # @option opts [String] file ('showcase.png') the file to save in dir. Will be overwritten.
113
+ # @return [nil] Returns nothing.
114
+ # @api public
115
+ def showcase(opts = {})
116
+ range = Args::CardRange.new(opts[:range], deck_size: size)
117
+ showcase = Args::ShowcaseSpecial.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
118
+ sheet = Args::Sheet.new(custom_colors, {file: 'showcase.png'}).load!(opts, expand_by: size, layout: layout, dpi: dpi)
119
+ render_showcase(range, sheet, showcase)
120
+ end
121
+
122
+ # Renders a range of cards fanned out as if in a hand. Saves as PNG.
123
+ # See {file:samples/hand.rb} for full example
124
+ #
125
+ # @example
126
+ # hand range: :all, radius: :auto, margin: 20, fill_color: :white,
127
+ # angle_range: (Math::PI / -4.0)..(Math::PI / 2),
128
+ # dir: '_output', file: 'hand1.png'
129
+ #
130
+ # @option opts [Enumerable, :all] range (:all) the range of cards over which this will be rendered. See {file:README.md#Specifying_Ranges Specifying Ranges}
131
+ # @option opts [Fixnum] radius (:auto) the distance from the bottom of each card to the center of the fan. If set to `:auto`, then it is computed as 30% of the card's height.
132
+ # @option opts [Range] angle_range: ((Math::PI / -4.0)..(Math::PI / 2)). The overall width of the fan, in radians. Angle of zero is a vertical card. Further negative angles widen the fan counter-clockwise and positive angles widen the fan clockwise.
133
+ # @option opts [Fixnum] trim (0) the margin around the card to trim before putting into the image
134
+ # @option opts [Fixnum] trim_radius (0) the rounded rectangle radius around the card to trim before putting into the showcase
135
+ # @option opts [Fixnum] margin (75) the margin around the entire image
136
+ # @option opts [String, Color] fill_color (:white) backdrop color. Usually black or white. Supports gradients.
137
+ # @option opts [String] dir (_output) the directory for the output to be sent to. Will be created if it doesn't exist.
138
+ # @option opts [String] file ('hand.png') the file to save in dir. Will be overwritten.
139
+ # @return [nil] Returns nothing.
140
+ # @api public
141
+ def hand(opts = {})
142
+ range = Args::CardRange.new(opts[:range], deck_size: size)
143
+ hand = Args::HandSpecial.new(height).load!(opts, expand_by: size, layout: layout, dpi: dpi)
144
+ sheet = Args::Sheet.new(custom_colors, {file: 'hand.png', trim_radius: 0}).load!(opts, expand_by: size, layout: layout, dpi: dpi)
145
+ render_hand(range, sheet, hand)
146
+ end
147
+
148
+ end
149
+ end
@@ -1,37 +1,35 @@
1
- module Squib
2
- class Deck
3
-
4
- # Toggle hints globally.
5
- #
6
- # Text hints are rectangles around where the text will be laid out. They are intended to be temporary.
7
- # Setting a hint to nil or to :off will disable hints. @see samples/text.rb
8
- # @example
9
- # hint text: :cyan
10
- # hint text: :cyan
11
- #
12
- # @param [String] text the color of the text hint. To turn off use :off. @see README.md
13
- # @return [nil] Returns nothing
14
- # @api public
15
- def hint(text: :off)
16
- conf.text_hint = text
17
- end
18
-
19
- # Sets various defaults for this deck. Defaults can be overriden by the commands themselves when that command supports it.
20
- # @example
21
- # set font: 'Arial 26'
22
- # text 'blah' # in Arial 26
23
- # text 'blah24', font: 'Arial 24' # in Arial 24
24
- # set font: :default # Back to Squib-wide default
25
- #
26
- # @option opts font: the font string to set as default. Can also be set to `:default` to use the Squib-wide default.
27
- # @option opts img_dir: the default directory to READ images from. Default is `.`. Useful for switching from bw to color images.
28
- # @return [nil] Returns nothing
29
- # @api public
30
- def set(opts = {})
31
- opts = needs(opts, [:font, :img_dir])
32
- @font = opts[:font][0] #was expanded - just need the first
33
- @img_dir = opts[:img_dir]
34
- end
35
-
36
- end
37
- end
1
+ module Squib
2
+ class Deck
3
+
4
+ # Toggle hints globally.
5
+ #
6
+ # Text hints are rectangles around where the text will be laid out. They are intended to be temporary.
7
+ # Setting a hint to nil or to :off will disable hints. @see samples/text.rb
8
+ # @example
9
+ # hint text: :cyan
10
+ # hint text: :cyan
11
+ #
12
+ # @param [String] text the color of the text hint. To turn off use :off. @see README.md
13
+ # @return [nil] Returns nothing
14
+ # @api public
15
+ def hint(text: :off)
16
+ conf.text_hint = text
17
+ end
18
+
19
+ # Sets various defaults for this deck. Defaults can be overriden by the commands themselves when that command supports it.
20
+ # @example
21
+ # set font: 'Arial 26'
22
+ # text 'blah' # in Arial 26
23
+ # text 'blah24', font: 'Arial 24' # in Arial 24
24
+ # set font: :default # Back to Squib-wide default
25
+ #
26
+ # @option opts font: the font string to set as default. Can also be set to `:default` to use the Squib-wide default.
27
+ # @return [nil] Returns nothing
28
+ # @api public
29
+ def set(opts = {})
30
+ raise 'DEPRECATED: As of v0.7 img_dir is no longer supported in "set". Use config.yml instead.' if opts.key? :img_dir
31
+ @font = (opts[:font] == :default) ? Squib::SYSTEM_DEFAULTS[:default_font] : opts[:font]
32
+ end
33
+
34
+ end
35
+ end