Class: Prawn::Font::Metrics
- Inherits:
-
Object
- Object
- Prawn::Font::Metrics
- Includes:
- Wrapping
- Defined in:
- lib/prawn/font/metrics.rb
Overview
:nodoc:
Defined Under Namespace
Class Method Summary collapse
Instance Method Summary collapse
Methods included from Wrapping
Class Method Details
.[](font) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/prawn/font/metrics.rb', line 18 def self.[](font) data[font] ||= case(font) when /\.ttf$/ TTF.new(font) else Adobe.new(font) end end |
.data ⇒ Object
27 28 29 |
# File 'lib/prawn/font/metrics.rb', line 27 def self.data @data ||= {} end |
Instance Method Details
#string_height(string, options = {}) ⇒ Object
31 32 33 34 |
# File 'lib/prawn/font/metrics.rb', line 31 def string_height(string,={}) string = naive_wrap(string, [:line_width], [:font_size]) string.lines.to_a.length * font_height([:font_size]) end |