class Magick::RVG::Text
Attributes
cx[RW]
@private
cy[RW]
@private
Public Class Methods
new(x = 0, y = 0, text = nil, &block)
click to toggle source
Define a text string starting at [x
, y
]. Use
the RVG::TextConstructors#text
method to create Text
objects in a container.
container.text(100, 100, "Simple text").styles(:font=>'Arial')
Text
objects can contain Tspan
objects.
container.text(100, 100).styles(:font=>'Arial') do |t| t.tspan("Red text").styles(:fill=>'red') t.tspan("Blue text").styles(:fill=>'blue') end
Calls superclass method
Magick::RVG::TextBase::new
# File lib/rvg/text.rb, line 146 def initialize(x = 0, y = 0, text = nil, &block) @cx, @cy = Magick::RVG.convert_to_float(x, y) super(text, &block) end
Public Instance Methods
tref(obj, x = nil, y = nil)
click to toggle source
Reference a Tspan
object. x
and y
are just like x
and y
in RVG::TextBase#tspan
# File lib/rvg/text.rb, line 153 def tref(obj, x = nil, y = nil) raise ArgumentError, "wrong argument type #{obj.class} (expected Tspan)" unless obj.is_a?(Tspan) obj = obj.deep_copy obj.parent = self tref = Tref.new(obj, x, y, self) @tspans << tref tref end