parent
b2ea6cebde
commit
cd3bf1b3f2
|
|
@ -8,6 +8,7 @@ Features:
|
||||||
* Shorthands for `x`, `y`, `width`, and `height`! The words `x: 'middle'` and `x: 'middle + 1in'` will get interpreted. See the docs for details.
|
* Shorthands for `x`, `y`, `width`, and `height`! The words `x: 'middle'` and `x: 'middle + 1in'` will get interpreted. See the docs for details.
|
||||||
* Autoscaling text! `ellipsize: :autoscale` will now downscale your `font_size` if the text ellipsized. Thanks @Qgel! (#288, #111).
|
* Autoscaling text! `ellipsize: :autoscale` will now downscale your `font_size` if the text ellipsized. Thanks @Qgel! (#288, #111).
|
||||||
* Option checking!! Completely reworked the way we handle arguments in Squib internally (no external behavioral differences). Now, when you give an option to Squib that is not expected. Since every DSL method "knows" what options it takes, that also means we have EVERY option properly documented (missed a few...) AND we have an automated test that will tell us if we forget to document it.
|
* Option checking!! Completely reworked the way we handle arguments in Squib internally (no external behavioral differences). Now, when you give an option to Squib that is not expected. Since every DSL method "knows" what options it takes, that also means we have EVERY option properly documented (missed a few...) AND we have an automated test that will tell us if we forget to document it.
|
||||||
|
* `save_png` and `save_sheet` now have a `suffix` option which defaults to `''`. So now you can customize the filenames with `prefix`, `count_format`, and `suffix`.
|
||||||
|
|
||||||
Compatibility:
|
Compatibility:
|
||||||
* When saving PNGs with sprues, outputs start counting at zero - which is more consistent with the rest of Squib.
|
* When saving PNGs with sprues, outputs start counting at zero - which is more consistent with the rest of Squib.
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,18 @@ dir
|
||||||
prefix
|
prefix
|
||||||
default ``'card_'``
|
default ``'card_'``
|
||||||
|
|
||||||
the prefix of the file name to be printed.
|
the prefix of all the filenames saved
|
||||||
|
|
||||||
count_format
|
count_format
|
||||||
default: ``'%02d'``
|
default: ``'%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)
|
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)
|
||||||
|
|
||||||
|
suffix
|
||||||
|
default: ``''``
|
||||||
|
|
||||||
|
the suffix of all the filenames saved, just before the `.png` extension.
|
||||||
|
|
||||||
rotate
|
rotate
|
||||||
default: ``false``
|
default: ``false``
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,11 @@ count_format
|
||||||
|
|
||||||
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)
|
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)
|
||||||
|
|
||||||
|
suffix
|
||||||
|
default: ``''``
|
||||||
|
|
||||||
|
the suffix of all the filenames saved, just before the `.png` extension.
|
||||||
|
|
||||||
dir
|
dir
|
||||||
default: ``'_output'``
|
default: ``'_output'``
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ module Squib::Args
|
||||||
dir: '_output',
|
dir: '_output',
|
||||||
prefix: 'card_',
|
prefix: 'card_',
|
||||||
rotate: false,
|
rotate: false,
|
||||||
|
suffix: '',
|
||||||
trim_radius: 0,
|
trim_radius: 0,
|
||||||
trim: 0,
|
trim: 0,
|
||||||
}
|
}
|
||||||
|
|
@ -53,11 +54,11 @@ module Squib::Args
|
||||||
end
|
end
|
||||||
|
|
||||||
def full_filename(i)
|
def full_filename(i)
|
||||||
"#{dir[i]}/#{prefix[i]}#{count_format[i] % i}.png"
|
"#{dir[i]}/#{prefix[i]}#{count_format[i] % i}#{suffix[i]}.png"
|
||||||
end
|
end
|
||||||
|
|
||||||
def summary
|
def summary
|
||||||
"#{dir[0]}/#{prefix[0]}_*"
|
"#{dir[0]}/#{prefix[0]}_*#{suffix[0]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ module Squib::Args
|
||||||
height: 2550,
|
height: 2550,
|
||||||
margin: 75,
|
margin: 75,
|
||||||
prefix: 'sheet_',
|
prefix: 'sheet_',
|
||||||
|
suffix: '',
|
||||||
rows: :infinite,
|
rows: :infinite,
|
||||||
columns: 5,
|
columns: 5,
|
||||||
trim_radius: 0,
|
trim_radius: 0,
|
||||||
|
|
@ -95,7 +96,7 @@ module Squib::Args
|
||||||
if i.nil?
|
if i.nil?
|
||||||
"#{dir}/#{file}"
|
"#{dir}/#{file}"
|
||||||
else
|
else
|
||||||
"#{dir}/#{prefix}#{count_format % i}.png"
|
"#{dir}/#{prefix}#{count_format % i}#{suffix}.png"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ module Squib
|
||||||
def self.accepted_params
|
def self.accepted_params
|
||||||
%i(
|
%i(
|
||||||
range
|
range
|
||||||
dir prefix count_format
|
dir prefix suffix count_format
|
||||||
rotate trim trim_radius
|
rotate trim trim_radius
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ module Squib
|
||||||
%i(
|
%i(
|
||||||
range sprue
|
range sprue
|
||||||
columns rows rtl
|
columns rows rtl
|
||||||
prefix count_format dir
|
dir prefix count_format suffix
|
||||||
margin gap trim trim_radius
|
margin gap trim trim_radius
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ module Squib
|
||||||
else
|
else
|
||||||
@cairo_surface
|
@cairo_surface
|
||||||
end
|
end
|
||||||
write_png(surface, index, batch.dir, batch.prefix, batch.count_format)
|
write_png(surface, index, batch)
|
||||||
end
|
end
|
||||||
|
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
|
|
@ -44,8 +44,8 @@ module Squib
|
||||||
return new_cc.target
|
return new_cc.target
|
||||||
end
|
end
|
||||||
|
|
||||||
def write_png(surface, i, dir, prefix, count_format)
|
def write_png(surface, i, b)
|
||||||
surface.write_to_png("#{dir}/#{prefix}#{count_format % i}.png")
|
surface.write_to_png("#{b.dir}/#{b.prefix}#{b.count_format % i}#{b.suffix}.png")
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@ Squib::Deck.new(width: 50, height: 50, cards: 2) do
|
||||||
# bar.png
|
# bar.png
|
||||||
save_png prefix: ['foo', 'bar'], count_format: ''
|
save_png prefix: ['foo', 'bar'], count_format: ''
|
||||||
|
|
||||||
|
# foo_00_bar.png
|
||||||
|
# foo_01_bar.png
|
||||||
|
save_png prefix: 'foo_', suffix: '_bar'
|
||||||
|
|
||||||
# thief.png
|
# thief.png
|
||||||
# thug.png
|
# thug.png
|
||||||
data = csv data: "filename\nthief\nthug"
|
data = csv data: "filename\nthief\nthug"
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,7 @@ Squib::Deck.new(width: 825, height: 1125, cards: 16) do
|
||||||
|
|
||||||
# Sheets can arrange left-to-right and right-to-left
|
# Sheets can arrange left-to-right and right-to-left
|
||||||
save_sheet prefix: 'save_sheet_rtl_',
|
save_sheet prefix: 'save_sheet_rtl_',
|
||||||
|
suffix: '_with_suffix',
|
||||||
range: 0..1, rtl: true,
|
range: 0..1, rtl: true,
|
||||||
columns: 2, rows: 1,
|
columns: 2, rows: 1,
|
||||||
margin: 75, gap: 5, trim: 37
|
margin: 75, gap: 5, trim: 37
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
|
|
@ -1791,7 +1791,7 @@ cairo: set_source([MockDouble, -37, -37])
|
||||||
cairo: paint([])
|
cairo: paint([])
|
||||||
cairo: set_source([MockDouble, 662, 75])
|
cairo: set_source([MockDouble, 662, 75])
|
||||||
cairo: paint([])
|
cairo: paint([])
|
||||||
surface: write_to_png(["_output/save_sheet_rtl_00.png"])
|
surface: write_to_png(["_output/save_sheet_rtl_00_with_suffix.png"])
|
||||||
surface: finish([])
|
surface: finish([])
|
||||||
surface: finish([])
|
surface: finish([])
|
||||||
surface: finish([])
|
surface: finish([])
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue