Class: Magick::RVG::Utility::DefaultTextStrategy

Inherits:
TextStrategy
  • Object
show all
Defined in:
lib/rvg/misc.rb

Overview

Handle “easy” text

Instance Method Summary collapse

Methods inherited from TextStrategy

#enquote, #glyph_metrics, #initialize, #render_glyph, #shift_baseline, #text_rel_coords

Constructor Details

This class inherits a constructor from Magick::RVG::Utility::TextStrategy

Instance Method Details

#render(x, y, text) ⇒ Object



300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/rvg/misc.rb', line 300

def render(x, y, text)
    @ctx.gc.text(x, y, enquote(text))
    tm = @ctx.shadow.get_type_metrics(text)
    dx = case @ctx.text_attrs.text_anchor
            when :start
                 tm.width
            when :middle
                 tm.width / 2
            when :end
                 0
          end
    [dx, 0]
end