Class: Languages::Epl2::Text

Inherits:
Object
  • Object
show all
Defined in:
lib/languages/epl2/text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Text

Returns a new instance of Text.



6
7
8
9
10
11
12
# File 'lib/languages/epl2/text.rb', line 6

def initialize(opts = {})
  # FIXME
  @position = Languages::Epl2::Position[0,0]
  @font = opts[:font] || Epl2::Font.new
  @position = Languages::Epl2::Position.from_array(opts[:at]) if opts.has_key?(:at)
  @text = ""
end

Instance Attribute Details

#fontObject

Returns the value of attribute font.



4
5
6
# File 'lib/languages/epl2/text.rb', line 4

def font
  @font
end

#positionObject

Returns the value of attribute position.



4
5
6
# File 'lib/languages/epl2/text.rb', line 4

def position
  @position
end

#textObject

Returns the value of attribute text.



4
5
6
# File 'lib/languages/epl2/text.rb', line 4

def text
  @text
end

Instance Method Details

#renderObject



14
15
16
# File 'lib/languages/epl2/text.rb', line 14

def render
  "A#{@position},#{@font.rotation},#{@font.name},#{@font.height},#{@font.width},N,\"#{@text}\""
end

#x=(x) ⇒ Object



18
19
20
# File 'lib/languages/epl2/text.rb', line 18

def x=(x)
  @position.x = x
end

#y=(y) ⇒ Object



22
23
24
# File 'lib/languages/epl2/text.rb', line 22

def y=(y)
  @position.y = y
end