class Squib::DSL::Text

Attributes

deck[R]
dsl_method[R]
embed[R]

Public Class Methods

accepted_params() click to toggle source
# File lib/squib/dsl/text.rb, line 29
def self.accepted_params
  %i(
    str font font_size x y markup width height
    wrap spacing align justify valign ellipsize angle dash cap join
    hint color fill_color
    stroke_color stroke_width stroke_width stroke_color stroke_strategy
    range layout
  )
end
new(deck, dsl_method, embed) click to toggle source
# File lib/squib/dsl/text.rb, line 23
def initialize(deck, dsl_method, embed)
  @deck = deck
  @dsl_method = dsl_method
  @embed = embed
end

Public Instance Methods

run(opts) click to toggle source
# File lib/squib/dsl/text.rb, line 39
def run(opts)
  warn_if_unexpected opts
  range = Args.extract_range opts, deck
  para  = Args.extract_para opts, deck
  box   = Args.extract_box opts, deck, { width: :auto, height: :auto }
  trans = Args.extract_transform opts, deck
  draw  = Args.extract_draw opts, deck, { stroke_width: 0.0 }
  extents = Array.new(deck.size)
  range.each do |i|
    extents[i] = deck.cards[i].text(embed, para[i], box[i], trans[i], draw[i], deck.dpi)
  end
  return extents
end