def render(x, y, text)
x_rel_coords, y_rel_coords = text_rel_coords(text)
dx = x_rel_coords.inject(0) {|sum, a| sum + a}
dy = y_rel_coords.max
@ctx.gc.push
@ctx.gc.text_anchor(Magick::StartAnchor)
if @ctx.text_attrs.text_anchor == :end
x -= dx
elsif @ctx.text_attrs.text_anchor == :middle
x -= dx / 2
end
case @ctx.text_attrs.glyph_orientation_horizontal
when 0
when 90
y -= dy
when 180
x += x_rel_coords.shift
x_rel_coords << 0
y -= dy
when 270
x += x_rel_coords[0]
end
y += shift_baseline(@ctx.text_attrs.glyph_orientation_horizontal, text[0,1])
first_word = true
text.split(::Magick::RVG::WORD_SEP).each do |word|
unless first_word
x += x_rel_coords.shift
end
first_word = false
word.split('').each do |glyph|
render_glyph(@ctx.text_attrs.glyph_orientation_horizontal, x, y, glyph)
x += x_rel_coords.shift
end
end
@ctx.gc.pop
[dx, 0]
end