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



320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/rvg/misc.rb', line 320

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