Class: Prune::Fonts::Courier
- Defined in:
- lib/prune/fonts/en/courier.rb
Overview
Courier font.
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document, options = {}) ⇒ Courier
constructor
A new instance of Courier.
-
#width(string, font_size) ⇒ Object
Get width of the text.
Methods inherited from BaseEn
Methods inherited from Base
bold?, #encoding, font_name, #font_sym, italic?, #name, #reference
Methods included from PObjects
Constructor Details
#initialize(document, options = {}) ⇒ Courier
Returns a new instance of Courier.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/prune/fonts/en/courier.rb', line 16 def initialize(document, = {}) super(document) self.name = self.class.key() if bold?() && italic?() self.base_font = pn("Courier-BoldOblique") elsif bold?() self.base_font = pn("Courier-Bold") elsif italic?() self.base_font = pn("Courier-Oblique") else self.base_font = pn(:Courier) end end |
Class Method Details
Instance Method Details
#width(string, font_size) ⇒ Object
Get width of the text.
31 32 33 |
# File 'lib/prune/fonts/en/courier.rb', line 31 def width(string, font_size) string.size * 600 * font_size / 1000 end |