Class: Spreadsheet::Font
- Inherits:
-
Object
- Object
- Spreadsheet::Font
- Defined in:
- lib/spreadsheet/font.rb
Overview
Font formatting data
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#bold=(bool) ⇒ Object
Sets #weight to :bold if(bool), :normal otherwise.
-
#color ⇒ Object
Font color.
-
#escapement ⇒ Object
Escapement Valid values: :normal, :superscript or :subscript.
-
#initialize(name, opts = {}) ⇒ Font
constructor
A new instance of Font.
-
#italic ⇒ Object
You can set the following boolean Font attributes * #italic * #strikeout * #outline * #shadow.
-
#key ⇒ Object
:nodoc:.
-
#weight ⇒ Object
Font weight Valid values: :normal, :bold or any positive Integer.
Methods included from Datatypes
Methods included from Compatibility
Constructor Details
#initialize(name, opts = {}) ⇒ Font
Returns a new instance of Font.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/spreadsheet/font.rb', line 63 def initialize name, opts = {} self.name = name @color = :text @previous_fast_key = nil @size = nil @weight = nil @italic = nil @strikeout = nil @outline = nil @shadow = nil @escapement = nil @underline = nil @family = nil @encoding = nil opts.each do |key, val| send :"#{key}=", val end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
10 11 12 |
# File 'lib/spreadsheet/font.rb', line 10 def name @name end |
Instance Method Details
#bold=(bool) ⇒ Object
Sets #weight to :bold if(bool), :normal otherwise.
84 85 86 |
# File 'lib/spreadsheet/font.rb', line 84 def bold= bool self.weight = bool ? :bold : nil end |
#color ⇒ Object
Font color
20 |
# File 'lib/spreadsheet/font.rb', line 20 colors :color |
#escapement ⇒ Object
Escapement Valid values: :normal, :superscript or :subscript. Default: :normal
34 35 36 |
# File 'lib/spreadsheet/font.rb', line 34 enum :escapement, :normal, :superscript, :subscript, subscript: :sub, superscript: :super |
#italic ⇒ Object
You can set the following boolean Font attributes
-
#italic
-
#strikeout
-
#outline
-
#shadow
17 |
# File 'lib/spreadsheet/font.rb', line 17 boolean :italic, :strikeout, :outline, :shadow |
#key ⇒ Object
:nodoc:
88 89 90 91 92 93 |
# File 'lib/spreadsheet/font.rb', line 88 def key # :nodoc: fk = fast_key return @key if @previous_fast_key == fk @previous_fast_key = fk @key = build_key end |
#weight ⇒ Object
Font weight Valid values: :normal, :bold or any positive Integer. In Excel:
100 <= weight <= 1000
:bold => 700
:normal => 400
Default: :normal
29 |
# File 'lib/spreadsheet/font.rb', line 29 enum :weight, :normal, :bold, Integer, bold: :b |