👮 spaces around operators
This commit is contained in:
@@ -9,7 +9,7 @@ module Squib
|
||||
# DSL method. See http://squib.readthedocs.org
|
||||
def set(opts = {})
|
||||
raise 'DEPRECATED: As of v0.7 img_dir is no longer supported in "set". Use config.yml instead.' if opts.key? :img_dir
|
||||
@font = (opts[:font] == :default) ? Squib::DEFAULT_FONT: opts[:font]
|
||||
@font = (opts[:font] == :default) ? Squib::DEFAULT_FONT : opts[:font]
|
||||
end
|
||||
|
||||
# DSL method. See http://squib.readthedocs.org
|
||||
|
||||
@@ -43,7 +43,7 @@ module Squib
|
||||
range = Args::CardRange.new(opts[:range], deck_size: @deck_size)
|
||||
paint = Args::Paint.new(@custom_colors).load!(opts, expand_by: @deck_size, layout: @layout)
|
||||
box = Args::Box.new(self, { width: :native, height: :native }).load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
adjust= Args::EmbedAdjust.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
adjust = Args::EmbedAdjust.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
trans = Args::Transform.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
ifile = Args::InputFile.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
svg_args = Args::SvgSpecial.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
@@ -77,7 +77,7 @@ module Squib
|
||||
range = Args::CardRange.new(opts[:range], deck_size: @deck_size)
|
||||
paint = Args::Paint.new(@custom_colors).load!(opts, expand_by: @deck_size, layout: @layout)
|
||||
box = Args::Box.new(self, { width: :native, height: :native }).load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
adjust= Args::EmbedAdjust.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
adjust = Args::EmbedAdjust.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
trans = Args::Transform.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
ifile = Args::InputFile.new.load!(opts, expand_by: @deck_size, layout: @layout, dpi: @dpi)
|
||||
rule = { type: :png, file: ifile, box: box, paint: paint, trans: trans, adjust: adjust }
|
||||
|
||||
@@ -23,7 +23,7 @@ module Squib
|
||||
input = 0..(deck_size - 1) if input == :all
|
||||
input = (input.to_i)..(input.to_i) if input.respond_to? :to_i
|
||||
raise ArgumentError.new("#{input} must be Enumerable (i.e. respond_to :each).") unless input.respond_to? :each
|
||||
raise ArgumentError.new("#{input} is outside of deck range of 0..#{deck_size-1}") if (!input.max.nil?) && (input.max > (deck_size - 1))
|
||||
raise ArgumentError.new("#{input} is outside of deck range of 0..#{deck_size - 1}") if (!input.max.nil?) && (input.max > (deck_size - 1))
|
||||
input
|
||||
end
|
||||
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ module Squib
|
||||
'ellipsis' => "\u2026",
|
||||
'smart_quotes' => true,
|
||||
'text_hint' => 'off',
|
||||
'warn_ellipsize'=> true,
|
||||
'warn_png_scale'=> true,
|
||||
'warn_ellipsize' => true,
|
||||
'warn_png_scale' => true,
|
||||
}
|
||||
|
||||
#Translate the hints to the methods.
|
||||
|
||||
@@ -105,7 +105,7 @@ module Squib
|
||||
v = vertical ? -1.0 : 1.0
|
||||
h = horizontal ? -1.0 : 1.0
|
||||
transform Cairo::Matrix.new(v, 0.0, 0.0,
|
||||
h, x*(1-v), y*(1-h))
|
||||
h, x * (1 - v), y * (1 - h))
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ module Squib
|
||||
end
|
||||
end
|
||||
x, y, w, h = cxt.target.ink_extents # I love Ruby assignment ;)
|
||||
png_cxt = Squib::Graphics::CairoContextWrapper.new(Cairo::Context.new(Cairo::ImageSurface.new(w + 2*sheet.margin, h + 2*sheet.margin)))
|
||||
png_cxt = Squib::Graphics::CairoContextWrapper.new(Cairo::Context.new(Cairo::ImageSurface.new(w + 2 * sheet.margin, h + 2 * sheet.margin)))
|
||||
png_cxt.set_source_squibcolor(sheet.fill_color)
|
||||
png_cxt.paint
|
||||
png_cxt.translate(-x + sheet.margin, -y + sheet.margin)
|
||||
|
||||
@@ -32,10 +32,10 @@ module Squib
|
||||
bar.increment
|
||||
cc.reset_clip
|
||||
cc.translate(-x, -y)
|
||||
x += card.width + sheet.gap - 2*sheet.trim
|
||||
x += card.width + sheet.gap - 2 * sheet.trim
|
||||
if x > (sheet.width - card_width - sheet.margin)
|
||||
x = sheet.margin
|
||||
y += card.height + sheet.gap - 2*sheet.trim
|
||||
y += card.height + sheet.gap - 2 * sheet.trim
|
||||
if y > (sheet.height - card_height - sheet.margin)
|
||||
cc.show_page # next page
|
||||
x, y = sheet.margin, sheet.margin
|
||||
@@ -90,9 +90,9 @@ module Squib
|
||||
# @api private
|
||||
def trim(surface, trim, width, height)
|
||||
if trim > 0
|
||||
tmp = Cairo::ImageSurface.new(width-2*trim, height-2*trim)
|
||||
tmp = Cairo::ImageSurface.new(width - 2 * trim, height - 2 * trim)
|
||||
cc = Cairo::Context.new(tmp)
|
||||
cc.set_source(surface, -1*trim, -1*trim)
|
||||
cc.set_source(surface, -1 * trim, -1 * trim)
|
||||
cc.paint
|
||||
surface = tmp
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ module Squib
|
||||
end
|
||||
|
||||
def preprocessed_save(angle, trim, trim_radius)
|
||||
new_width, new_height = @width - 2*trim, @height - 2*trim
|
||||
new_width, new_height = @width - 2 * trim, @height - 2 * trim
|
||||
new_cc = Cairo::Context.new(Cairo::ImageSurface.new(new_width, new_height))
|
||||
new_cc.translate(new_width * 0.5, new_height * 0.5)
|
||||
new_cc.rotate(angle)
|
||||
|
||||
@@ -30,19 +30,19 @@ module Squib
|
||||
def ellipse(box, draw)
|
||||
x, y, w, h = box.x, box.y, box.width, box.height
|
||||
use_cairo do |cc|
|
||||
cc.move_to(x, y + 0.5*h) # start west
|
||||
cc.curve_to(x, y + 0.25*h, # west to north
|
||||
x + 0.25*w, y,
|
||||
x + 0.5*w, y)
|
||||
cc.curve_to(x + 0.75*w, y, # north to east
|
||||
x + w, y + 0.25*h,
|
||||
x + w, y + 0.5*h)
|
||||
cc.curve_to(x + w, y + 0.75*h, # east to south
|
||||
x + 0.75*w, y + h,
|
||||
x + 0.5*w, y + h)
|
||||
cc.curve_to(x + 0.25*w, y + h, # south to west
|
||||
x, y + 0.75*h,
|
||||
x, y + 0.5*h)
|
||||
cc.move_to(x, y + 0.5 * h) # start west
|
||||
cc.curve_to(x, y + 0.25 * h, # west to north
|
||||
x + 0.25 * w, y,
|
||||
x + 0.5 * w, y)
|
||||
cc.curve_to(x + 0.75 * w, y, # north to east
|
||||
x + w, y + 0.25 * h,
|
||||
x + w, y + 0.5 * h)
|
||||
cc.curve_to(x + w, y + 0.75 * h, # east to south
|
||||
x + 0.75 * w, y + h,
|
||||
x + 0.5 * w, y + h)
|
||||
cc.curve_to(x + 0.25 * w, y + h, # south to west
|
||||
x, y + 0.75 * h,
|
||||
x, y + 0.5 * h)
|
||||
cc.fill_n_stroke(draw)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,8 +12,8 @@ module Squib
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def render_showcase(range, sheet, showcase)
|
||||
out_width = range.size * ((@width - 2*sheet.trim) * showcase.scale * showcase.offset) + 2*sheet.margin
|
||||
out_height = showcase.reflect_offset + (1.0 + showcase.reflect_percent) * (@height - 2*sheet.trim) + 2*sheet.margin
|
||||
out_width = range.size * ((@width - 2 * sheet.trim) * showcase.scale * showcase.offset) + 2 * sheet.margin
|
||||
out_height = showcase.reflect_offset + (1.0 + showcase.reflect_percent) * (@height - 2 * sheet.trim) + 2 * sheet.margin
|
||||
out_cc = Cairo::Context.new(Cairo::ImageSurface.new(out_width, out_height))
|
||||
wrapper = Squib::Graphics::CairoContextWrapper.new(out_cc)
|
||||
wrapper.set_source_squibcolor(sheet.fill_color)
|
||||
@@ -33,7 +33,7 @@ module Squib
|
||||
# :nodoc:
|
||||
# @api private
|
||||
def trim_rounded(src, trim, radius)
|
||||
trim_cc = Cairo::Context.new(Cairo::ImageSurface.new(src.width-2.0*trim, src.height-2.0*trim))
|
||||
trim_cc = Cairo::Context.new(Cairo::ImageSurface.new(src.width - 2.0 * trim, src.height - 2.0 * trim))
|
||||
trim_cc.rounded_rectangle(0, 0, trim_cc.target.width, trim_cc.target.height, radius, radius)
|
||||
trim_cc.set_source(src, -1 * trim, -1 * trim)
|
||||
trim_cc.clip
|
||||
|
||||
Reference in New Issue
Block a user