lib/prawn/font/afm.rb
# NOTE: String *must* be encoded as WinAnsi
String *must* be encoded as WinAnsi
String * must * be encoded as WinAnsi
def compute_width_of(string, options={}) 
        scale = (options[:size] || size) / 1000.0
        if options[:kerning]
          strings, numbers = kern(string).partition { |e| e.is_a?(String) }
          total_kerning_offset = numbers.inject(0.0) { |s,r| s + r }
          (unscaled_width_of(strings.join) - total_kerning_offset) * scale
        else
          unscaled_width_of(string) * scale
        end
      end
def compute_width_of ( string , options = { } ) scale = ( options [ :size ] || size ) / 1000.0 if options [ :kerning ] strings , numbers = kern ( string ) . partition { | e | e . is_a? ( String ) } total_kerning_offset = numbers . inject ( 0.0 ) { | s , r | s + r } ( unscaled_width_of ( strings . join ) - total_kerning_offset ) * scale else unscaled_width_of ( string ) * scale end end
NOTE: String *must* be encoded as WinAnsi
NOTE : String * must * be encoded as WinAnsi
#:nodoc:
string
<not_specific>
options
<not_specific>