lib/prawn/font/afm.rb
# converts a string into an array with spacing offsets
# bewteen characters that need to be kerned
#
# String *must* be encoded as WinAnsi
#
converts a string into an array with spacing offsets
bewteen characters that need to be kerned

String *must* be encoded as WinAnsi
converts a string into an array with spacing offsets bewteen characters that need to be kerned String * must * be encoded as WinAnsi
def kern(string)
        kerned = [[]]
        last_byte = nil
        string.bytes do |byte|
          if k = last_byte && @kern_pair_table[[last_byte, byte]]
            kerned << -k << [byte]
          else
            kerned.last << byte
          end         
          last_byte = byte
        end
        kerned.map { |e| 
          e = (Array === e ? e.pack("C*") : e)
          e.respond_to?(:force_encoding) ? e.force_encoding("Windows-1252") : e  
        }
      end
def kern ( string ) kerned = [ [ ] ] last_byte = nil string . bytes do | byte | if k = last_byte && @kern_pair_table [ [ last_byte , byte ] ] kerned << - k << [ byte ] else kerned . last << byte end last_byte = byte end kerned . map { | e | e = ( Array === e ? e . pack ( "C*" ) : e ) e . respond_to? ( :force_encoding ) ? e . force_encoding ( "Windows-1252" ) : e } end
converts a string into an array with spacing offsets
bewteen characters that need to be kerned
converts a string into an array with spacing offsets bewteen characters that need to be kerned
string
<not_specific>