Class: Prune::Fonts::Symbol
- Defined in:
- lib/prune/fonts/en/symbol.rb
Overview
Symbol font.
Constant Summary collapse
- WIDTHS =
[ 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 333, 713, 500, 549, 833, 778, 439, 333, 333, 500, 549, 250, 549, 250, 278, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 278, 278, 549, 549, 549, 444, 549, 722, 667, 722, 612, 611, 763, 603, 722, 333, 631, 722, 686, 889, 722, 722, 768, 741, 556, 592, 611, 690, 439, 768, 645, 795, 611, 333, 863, 333, 658, 500, 500, 631, 549, 549, 494, 439, 521, 411, 603, 329, 603, 549, 549, 576, 521, 549, 549, 521, 549, 603, 439, 576, 713, 686, 493, 686, 494, 480, 200, 480, 549, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 750, 620, 247, 549, 167, 713, 500, 753, 753, 753, 753, 1042, 987, 603, 987, 603, 400, 549, 411, 549, 549, 713, 494, 460, 549, 549, 549, 549, 1000, 603, 1000, 658, 823, 686, 795, 987, 768, 768, 823, 768, 768, 713, 713, 713, 713, 713, 713, 713, 768, 713, 790, 790, 890, 823, 549, 250, 713, 603, 603, 1042, 987, 603, 987, 603, 494, 329, 790, 790, 786, 713, 384, 384, 384, 384, 384, 384, 494, 494, 494, 494, 0, 329, 274, 686, 686, 686, 384, 384, 384, 384, 384, 384, 494, 494, 494, 0 ]
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document, options = {}) ⇒ Symbol
constructor
A new instance of Symbol.
-
#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 = {}) ⇒ Symbol
Returns a new instance of Symbol.
43 44 45 46 47 |
# File 'lib/prune/fonts/en/symbol.rb', line 43 def initialize(document, = {}) super(document) self.name = self.class.key() self.base_font = pn(:Symbol) end |
Class Method Details
.key(options) ⇒ Object
8 9 10 11 |
# File 'lib/prune/fonts/en/symbol.rb', line 8 def key() FontOptionError if bold?() || italic?() PObjects.pn(font_name) end |
Instance Method Details
#width(string, font_size) ⇒ Object
Get width of the text.
50 51 52 53 54 55 56 |
# File 'lib/prune/fonts/en/symbol.rb', line 50 def width(string, font_size) string_base_width = string.bytes.inject(0){|result, byte| byte_width = WIDTHS[byte] || 1000 result + byte_width } string_base_width * font_size / 1000 end |