Browse Source

Embedded icons respect img_dir

dev
Andy Meneely 10 years ago
parent
commit
0fe5c55b9e
  1. 2
      lib/squib/api/text.rb
  2. 11
      lib/squib/api/text_embed.rb

2
lib/squib/api/text.rb

@ -54,7 +54,7 @@ module Squib
box = Args::Box.new(self, {width: :auto, height: :auto}).load!(opts, expand_by: size, layout: layout, dpi: dpi)
trans = Args::Transform.new.load!(opts, expand_by: size, layout: layout, dpi: dpi)
draw = Args::Draw.new(custom_colors, {stroke_width: 0.0}).load!(opts, expand_by: size, layout: layout, dpi: dpi)
embed = TextEmbed.new(size, custom_colors, layout, dpi)
embed = TextEmbed.new(size, custom_colors, layout, dpi, img_dir)
yield(embed) if block_given? #store the opts for later use
extents = Array.new(@cards.size)
range.each { |i| extents[i] = @cards[i].text(embed, para[i], box[i], trans[i], draw[i]) }

11
lib/squib/api/text_embed.rb

@ -14,11 +14,12 @@ module Squib
# :nodoc:
# @api private
def initialize(deck_size, custom_colors, layout, dpi)
def initialize(deck_size, custom_colors, layout, dpi, img_dir)
@deck_size = deck_size
@custom_colors = custom_colors
@layout = layout
@dpi = dpi
@img_dir = img_dir
@rules = {} # store an array of options for later usage
end
@ -51,7 +52,9 @@ module Squib
i = card.index
b = box[i]
b.x, b.y = x, y
card.svg(ifile[i].file, svg_args[i], b, paint[i], trans[i])
Dir.chdir(@img_dir) do
card.svg(ifile[i].file, svg_args[i], b, paint[i], trans[i])
end
end
@rules[key] = rule
end
@ -82,7 +85,9 @@ module Squib
i = card.index
b = box[i]
b.x, b.y = x, y
card.png(ifile[i].file, b, paint[i], trans[i])
Dir.chdir(@img_dir) do
card.png(ifile[i].file, b, paint[i], trans[i])
end
end
@rules[key] = rule
end

Loading…
Cancel
Save