Class | Prawn::Font::AFM
In: | lib/prawn/font/afm.rb
Parent: | Font

### Methods

bbox compute_width_of encode_text has_kerning_data? metrics_path new normalize_encoding

### Constants

BUILT_INS | = | %w[ Courier Helvetica Times-Roman Symbol ZapfDingbats Courier-Bold Courier-Oblique Courier-BoldOblique Times-Bold Times-Italic Times-BoldItalic Helvetica-Bold Helvetica-Oblique Helvetica-BoldOblique ]

### Attributes

attributes | [R] |

### Public Class methods

metrics_path()
new(document, name, options={})

### Public Instance methods

bbox()
compute_width_of(string, options={})

calculates the width of the supplied string.

String must be encoded as WinAnsi

encode_text(text, options={})

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).

has_kerning_data?()
normalize_encoding(text)

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.

[Validate]