# File lib/prawn/font/afm.rb, line 22 def self.metrics_path if m = ENV['METRICS'] @metrics_path ||= m.split(':') else @metrics_path ||= [ ".", "/usr/lib/afm", "/usr/local/lib/afm", "/usr/openwin/lib/fonts/afm/", Prawn::BASEDIR+'/data/fonts/'] end end
The font bbox, as an array of integers
# File lib/prawn/font/afm.rb, line 61 def bbox @bbox ||= @attributes['fontbbox'].split(%r\s+/).map { |e| Integer(e) } end
Perform any changes to the string that need to happen before it is rendered to the canvas. Returns an array of subset “chunks”, where each chunk is an array of two elements. The first element is the font subset number, and the second is either a string or an array (for kerned text).
For Adobe fonts, there is only ever a single subset, so the first element of the array is “0”, and the second is the string itself (or an array, if kerning is performed).
The text
parameter must be in WinAnsi encoding (cp1252).
# File lib/prawn/font/afm.rb, line 105 def encode_text(text, options={}) [[0, options[:kerning] ? kern(text) : text]] end
Returns true if the font has kerning data, false otherwise
# File lib/prawn/font/afm.rb, line 80 def has_kerning_data? @kern_pairs.any? end
built-in fonts only work with winansi encoding, so translate the string. Changes the encoding in-place, so the argument itself is replaced with a string in WinAnsi encoding.
# File lib/prawn/font/afm.rb, line 88 def normalize_encoding(text) enc = Prawn::Encoding::WinAnsi.new text.unpack("U*").collect { |i| enc[i] }.pack("C*") end
# File lib/prawn/font/afm.rb, line 18 def unicode? false end