@@ -7,15 +7,16 @@ class PDF::Reader
77 class TextRun
88 include Comparable
99
10- attr_reader :origin , :width , :font_size , :text
10+ attr_reader :origin , :width , :font_size , :text , :state
1111
1212 alias :to_s :text
1313
14- def initialize ( x , y , width , font_size , text )
14+ def initialize ( x , y , width , font_size , text , state )
1515 @origin = PDF ::Reader ::Point . new ( x , y )
1616 @width = width
1717 @font_size = font_size
1818 @text = text
19+ @state = state
1920 end
2021
2122 # Allows collections of TextRun objects to be sorted. They will be sorted
@@ -62,14 +63,14 @@ def +(other)
6263 raise ArgumentError , "#{ other } cannot be merged with this run" unless mergable? ( other )
6364
6465 if ( other . x - endx ) <( font_size * 0.2 )
65- TextRun . new ( x , y , other . endx - x , font_size , text + other . text )
66+ TextRun . new ( x , y , other . endx - x , font_size , text + other . text , { } )
6667 else
67- TextRun . new ( x , y , other . endx - x , font_size , "#{ text } #{ other . text } " )
68+ TextRun . new ( x , y , other . endx - x , font_size , "#{ text } #{ other . text } " , { } )
6869 end
6970 end
7071
7172 def inspect
72- "#{ text } w:#{ width } f:#{ font_size } @#{ x } ,#{ y } "
73+ "#{ text } w:#{ width } f:#{ font_size } @#{ x } ,#{ y } #{ @state . inspect } "
7374 end
7475
7576 def intersect? ( other_run )
0 commit comments