class MemeCaptain::TextPos

Text to put on an image with position and style options.

Attributes

draw_options[RW]
height[RW]
max_lines[RW]
min_pointsize[RW]
text[RW]
width[RW]
x[RW]
y[RW]

Public Class Methods

new(text, x, y, width, height, options = {}) click to toggle source

x and y are the coordinates of the top left corner of the text bounding rectangle.

width and height are the width and height of the text bounding rectangle.

x, y, width and height can be in pixels or a float that represents a percentage of the width and height of the image the text is put onto.

# File lib/meme_captain/text_pos.rb, line 18
def initialize(text, x, y, width, height, options = {})
  @text = text
  @x = x
  @y = y
  @width = width
  @height = height

  @max_lines = options.delete(:max_lines) || 16
  @min_pointsize = options.delete(:min_pointsize) || 12

  @draw_options = {
      fill: 'white',
      font: 'Impact',
      gravity: Magick::CenterGravity,
      stroke: 'black',
      stroke_width: 8,
  }.merge(options)
end