@@ -6,16 +6,17 @@ class PDF::Reader
66 class TextRun
77 include Comparable
88
9- attr_reader :x , :y , :width , :font_size , :text
9+ attr_reader :x , :y , :width , :font_size , :text , :state
1010
1111 alias :to_s :text
1212
13- def initialize ( x , y , width , font_size , text )
13+ def initialize ( x , y , width , font_size , text , state )
1414 @x = x
1515 @y = y
1616 @width = width
1717 @font_size = font_size . floor
1818 @text = text
19+ @state = state
1920 end
2021
2122 # Allows collections of TextRun objects to be sorted. They will be sorted
@@ -50,14 +51,14 @@ def +(other)
5051 raise ArgumentError , "#{ other } cannot be merged with this run" unless mergable? ( other )
5152
5253 if ( other . x - endx ) <( font_size * 0.2 )
53- TextRun . new ( x , y , other . endx - x , font_size , text + other . text )
54+ TextRun . new ( x , y , other . endx - x , font_size , text + other . text , { } )
5455 else
55- TextRun . new ( x , y , other . endx - x , font_size , "#{ text } #{ other . text } " )
56+ TextRun . new ( x , y , other . endx - x , font_size , "#{ text } #{ other . text } " , { } )
5657 end
5758 end
5859
5960 def inspect
60- "#{ text } w:#{ width } f:#{ font_size } @#{ x } ,#{ y } "
61+ "#{ text } w:#{ width } f:#{ font_size } @#{ x } ,#{ y } #{ @state . inspect } "
6162 end
6263
6364 private
0 commit comments