class Spreadsheet::Font

Font formatting data

Attributes

name[RW]

Public Class Methods

new(name, opts={}) click to toggle source
# File lib/spreadsheet/font.rb, line 64
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|
    self.send "#{key}=", val
  end
end

Public Instance Methods

bold=(bool) click to toggle source

Sets weight to :bold if(bool), :normal otherwise.

# File lib/spreadsheet/font.rb, line 84
def bold= bool
  self.weight = bool ? :bold : nil
end
color() click to toggle source

Font color

# File lib/spreadsheet/font.rb, line 21
colors :color
escapement() click to toggle source

Escapement Valid values: :normal, :superscript or :subscript. Default: :normal

# File lib/spreadsheet/font.rb, line 35
enum :escapement, :normal, :superscript, :subscript,
     :subscript   => :sub,
     :superscript => :super
italic() click to toggle source

You can set the following boolean Font attributes

  • italic

  • strikeout

  • outline

  • shadow

# File lib/spreadsheet/font.rb, line 18
boolean :italic, :strikeout, :outline, :shadow
weight() click to toggle source

Font weight Valid values: :normal, :bold or any positive Integer. In Excel:

100 <= weight <= 1000
:bold   => 700
:normal => 400

Default: :normal

# File lib/spreadsheet/font.rb, line 30
enum :weight, :normal, :bold, Integer, :bold => :b

Private Instance Methods

fast_key() click to toggle source
# File lib/spreadsheet/font.rb, line 111
def fast_key
  [@name, @size, @weight, @italic, @strikeout, @outline, @shadow, @escapement, @underline, @color, @family, @encoding]
end