Object
A value object that represents one or more consecutive characters on a page.
# File lib/pdf/reader/text_run.rb, line 47 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
Allows collections of TextRun objects to be sorted. They will be sorted in order of their position on a cartesian plain - Top Left to Bottom Right
# File lib/pdf/reader/text_run.rb, line 21 def <=>(other) if x == other.x && y == other.y 0 elsif y < other.y 1 elsif y > other.y -1 elsif x < other.x -1 elsif x > other.x 1 end end
# File lib/pdf/reader/text_run.rb, line 35 def endx @endx ||= x + width end
# File lib/pdf/reader/text_run.rb, line 57 def inspect "#{text} w:#{width} f:#{font_size} @#{x},#{y}" end
Generated with the Darkfish Rdoc Generator 2.