👮 fix extra spaces
parent
58c997684a
commit
137e3f91cd
2
Rakefile
2
Rakefile
|
|
@ -13,7 +13,7 @@ desc 'Run a specific sample'
|
|||
task :run, [:file] => :install do |t, args|
|
||||
args.with_defaults(file: 'basic.rb')
|
||||
Dir.chdir('samples') do
|
||||
args[:file] << ".rb" unless args[:file].end_with? '.rb'
|
||||
args[:file] << ".rb" unless args[:file].end_with? '.rb'
|
||||
puts "Running samples/#{args[:file]}"
|
||||
load args[:file]
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ Squib::Deck.new(cards: 200, config: 'antialias_best.yml') do
|
|||
x: (i % 17) * 50,
|
||||
y: (i / 17) * 50
|
||||
end
|
||||
save_png prefix: 'antialias_best_'
|
||||
save_png prefix: 'antialias_best_'
|
||||
end
|
||||
|
|
@ -9,5 +9,5 @@ Squib::Deck.new(cards: 200, config: 'antialias_fast.yml') do
|
|||
x: (i % 17) * 50,
|
||||
y: (i / 17) * 50
|
||||
end
|
||||
save_png prefix: 'antialias_fast_'
|
||||
save_png prefix: 'antialias_fast_'
|
||||
end
|
||||
|
|
@ -47,7 +47,7 @@ module Squib
|
|||
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)
|
||||
rule = { type: :png, file: ifile, box: box, paint: paint, trans: trans, adjust: adjust }
|
||||
rule = { type: :png, file: ifile, box: box, paint: paint, trans: trans, adjust: adjust }
|
||||
rule[:draw] = Proc.new do |card, x, y|
|
||||
i = card.index
|
||||
b = box[i]
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ module Squib
|
|||
attribute = "@#{param}"
|
||||
val = instance_variable_get(attribute)
|
||||
if val.respond_to? :each
|
||||
new_val = val.map.with_index{ |v, i| send(method, v, i) }
|
||||
new_val = val.map.with_index{ |v, i| send(method, v, i) }
|
||||
instance_variable_set(attribute, new_val)
|
||||
else
|
||||
instance_variable_set(attribute, send(method, val))
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ module Squib
|
|||
@width = Args::UnitConversion.parse width, dpi
|
||||
@height = Args::UnitConversion.parse height, dpi
|
||||
cards.times{ |i| @cards << Squib::Card.new(self, @width, @height, i) }
|
||||
@layout = LayoutParser.load_layout(layout)
|
||||
@layout = LayoutParser.load_layout(layout)
|
||||
enable_groups_from_env!
|
||||
if block_given?
|
||||
instance_eval(&block) # here we go. wheeeee!
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ module Squib
|
|||
linear.matrix = matrix # match the coordinate systems - see bug 127
|
||||
@cairo_cxt.set_source(linear)
|
||||
elsif match = arg.match(RADIAL_GRADIENT)
|
||||
x1, y1, r1, x2, y2, r2 = match.captures
|
||||
x1, y1, r1, x2, y2, r2 = match.captures
|
||||
radial = Cairo::RadialPattern.new(x1.to_f, y1.to_f, r1.to_f,
|
||||
x2.to_f, y2.to_f, r2.to_f)
|
||||
radial.matrix = matrix # match the coordinate systems - see bug 127
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ module Squib
|
|||
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)
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ module Squib
|
|||
font_desc.size = para.font_size * Pango::SCALE unless para.font_size.nil?
|
||||
layout = cc.create_pango_layout
|
||||
layout.font_description = font_desc
|
||||
layout.text = para.str
|
||||
layout.text = para.str
|
||||
if para.markup
|
||||
para.str = @deck.typographer.process(layout.text)
|
||||
layout.markup = para.str
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Squib::Deck.new(cards: num_cards) do
|
|||
background color: :white
|
||||
rect # card border
|
||||
text str: data['Name'], font: 'Arial 54'
|
||||
save_sheet prefix: 'sample_csv_qty_', columns: 4
|
||||
save_sheet prefix: 'sample_csv_qty_', columns: 4
|
||||
end
|
||||
|
||||
# Additionally, CSV supports inline data specifically
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ Squib::Deck.new(cards: num_cards) do
|
|||
background color: :white
|
||||
rect # card border
|
||||
text str: data['Name'], font: 'Arial 54'
|
||||
save_sheet prefix: 'sample_xlsx_qty_', columns: 4
|
||||
save_sheet prefix: 'sample_xlsx_qty_', columns: 4
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ end
|
|||
Squib::Deck.new do
|
||||
use_layout file: 'custom-layout.yml'
|
||||
use_layout file: 'custom-layout2.yml'
|
||||
text str: 'The Title', layout: :title # from custom-layout.yml
|
||||
text str: 'The Subtitle', layout: :subtitle # redefined in custom-layout2.yml
|
||||
text str: 'The Title', layout: :title # from custom-layout.yml
|
||||
text str: 'The Subtitle', layout: :subtitle # redefined in custom-layout2.yml
|
||||
save_png prefix: 'layout3_'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ Squib::Deck.new(width: 825, height: 1125, cards: 1, config: 'load_images_config.
|
|||
|
||||
# WARNING! If you choose to use the SVG ID, the x-y coordinates are still
|
||||
# relative to the SVG page. See this example in an SVG editor
|
||||
svg file: 'offset.svg', id: 'thing', x: 0, y: 0, width: 600, height: 600
|
||||
svg file: 'offset.svg', id: 'thing', x: 0, y: 0, width: 600, height: 600
|
||||
|
||||
# Over 15 different blending operators are supported.
|
||||
# See http://cairographics.org/operators
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ Squib::Deck.new(height: (game_chars.size / cols + 1) * cell_height,
|
|||
text str: 'Game-related UTF8 icons. Generated by Squib, https://github.com/andymeneely/squib'
|
||||
game_chars.each_with_index do |c, i|
|
||||
rect fill_color: %w(#eeee #ffff)[i % 2],
|
||||
width: cell_width, height: cell_height, x: x, y: y
|
||||
width: cell_width, height: cell_height, x: x, y: y
|
||||
text str: c.inspect, font: 'Sans 42', x: x, y: y
|
||||
text str: c, font: 'Sans,Segoe UI Symbol 42', x: x + 300, y: y
|
||||
x += cell_width
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ describe Squib::Args::Draw do
|
|||
end
|
||||
|
||||
context 'dsl overrides' do
|
||||
subject(:draw) {Squib::Args::Draw.new(custom_colors, {stroke_width: 0.0})}
|
||||
subject(:draw) {Squib::Args::Draw.new(custom_colors, {stroke_width: 0.0})}
|
||||
|
||||
it 'works when specified' do
|
||||
draw.load!({}) # go right to defaults
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require 'squib/args/paint'
|
|||
|
||||
describe Squib::Args::Draw do
|
||||
let(:custom_colors) { {'foo' => 'abc'} }
|
||||
subject(:paint) {Squib::Args::Paint.new(custom_colors)}
|
||||
subject(:paint) {Squib::Args::Paint.new(custom_colors)}
|
||||
|
||||
context 'alpha' do
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ describe Squib::Args::UnitConversion do
|
|||
expect(subject.parse(20)).to eq(20)
|
||||
end
|
||||
|
||||
it 'strips trailing whitespace' do
|
||||
it 'strips trailing whitespace' do
|
||||
expect(subject.parse('1in ')).to eq(300)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
require 'spec_helper'
|
||||
require 'squib'
|
||||
|
||||
describe Squib::Commands::New do
|
||||
describe Squib::Commands::New do
|
||||
|
||||
describe '#process' do
|
||||
before(:all) do
|
||||
|
|
|
|||
Loading…
Reference in New Issue