Method: PDF::Reader::TextRun#+

Defined in:
lib/pdf/reader/text_run.rb

#+(other) ⇒ Object

Raises:

  • (ArgumentError)


61
62
63
64
65
66
67
68
69
# File 'lib/pdf/reader/text_run.rb', line 61

def +(other)
  raise ArgumentError, "#{other} cannot be merged with this run" unless mergable?(other)

  if (other.x - endx) <( font_size * 0.2)
    TextRun.new(x, y, other.endx - x, font_size, text + other.text)
  else
    TextRun.new(x, y, other.endx - x, font_size, "#{text} #{other.text}")
  end
end