    # File lib/prawn/font/ttf.rb, line 75
          def encode_text(text,options={})
            text = text.chomp

            if options[:kerning]
              last_subset = nil
              kern(text).inject([]) do |result, element|
                if element.is_a?(Numeric)
                  result.last[1] = [result.last[1]] unless result.last[1].is_a?(Array)
                  result.last[1] << element
                  result
                else
                  encoded = @subsets.encode(element)

                  if encoded.first[0] == last_subset
                    result.last[1] << encoded.first[1]
                    encoded.shift
                  end

                  if encoded.any?
                    last_subset = encoded.last[0]
                    result + encoded
                  else
                    result
                  end
                end
              end
            else
              @subsets.encode(text.unpack("U*"))
            end
          end