class Magick::RVG::Text
def initialize(x = 0, y = 0, text = nil, &block)
t.tspan("Blue text").styles(:fill=>'blue')
t.tspan("Red text").styles(:fill=>'red')
container.text(100, 100).styles(:font=>'Arial') do |t|
Text objects can contain Tspan objects.
container.text(100, 100, "Simple text").styles(:font=>'Arial')
Use the RVG::TextConstructors#text method to create Text objects in a container.
Define a text string starting at [x, y].
def initialize(x = 0, y = 0, text = nil, &block) @cx, @cy = Magick::RVG.convert_to_float(x, y) super(text, &block) end
def tref(obj, x = nil, y = nil)
Reference a Tspan object. x and y are just
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