calculate_line_and_location (PDF::Reader::TextReceiver)

    # File lib/pdf/reader/text_receiver.rb, line 229
        def calculate_line_and_location (new_loc)
          ##puts "calculate_line_and_location(#{new_loc})"
          key = new_loc; key.freeze

          #key = new_loc.to_s # because hashes with string keys are magic (auto-freeze)

          if @written_to
            unless @displacement.has_key?(key)
              if key < @location
                @displacement[key] = @line + 1
              elsif key < @smallest_y_loc
                @displacement[key] = @line + 1
              else
                key = @displacement.keys.find_all {|i| key > i}.sort.last
                @displacement[key] = 0 unless @displacement.has_key?(key)
              end
            end
          else
            @displacement[key] = 0
          end

          @smallest_y_loc = key if key < @smallest_y_loc
          @location = key
          @line = @displacement[key]
          #puts "calculate_line_and_location: @location=#@location @line=#@line smallest_y_loc=#@smallest_y_loc"
        end