Class: RubyXL::Font

Inherits:
OOXMLObject show all
Defined in:
lib/rubyXL/objects/font.rb

Overview

Constant Summary collapse

MAX_DIGIT_WIDTH =

Since we have no capability to load the actual fonts, we'll have to live with the default.

7

Class Method Summary collapse

Instance Method Summary collapse

Methods included from OOXMLObjectInstanceMethods

#==, #before_write_xml, included, #index_in_collection, #initialize, #write_xml

Class Method Details

.default(size = 10) ⇒ Object


86
87
88
89
# File 'lib/rubyXL/objects/font.rb', line 86

def self.default(size = 10)
  self.new(:name => RubyXL::StringValue.new(:val => 'Verdana'),
           :sz   => RubyXL::FloatValue.new(:val => size) )
end

Instance Method Details

#get_nameObject


61
62
63
# File 'lib/rubyXL/objects/font.rb', line 61

def get_name
  name && name.val
end

#get_rgb_colorObject


77
78
79
# File 'lib/rubyXL/objects/font.rb', line 77

def get_rgb_color
  color && color.rgb
end

#get_sizeObject


69
70
71
# File 'lib/rubyXL/objects/font.rb', line 69

def get_size
  sz && sz.val
end

#is_boldObject


37
38
39
# File 'lib/rubyXL/objects/font.rb', line 37

def is_bold
  b && b.val
end

#is_italicObject


29
30
31
# File 'lib/rubyXL/objects/font.rb', line 29

def is_italic
  i && i.val
end

#is_strikethroughObject


53
54
55
# File 'lib/rubyXL/objects/font.rb', line 53

def is_strikethrough
  strike && strike.val
end

#is_underlinedObject


45
46
47
# File 'lib/rubyXL/objects/font.rb', line 45

def is_underlined
  u && u.val
end

#set_bold(val) ⇒ Object


41
42
43
# File 'lib/rubyXL/objects/font.rb', line 41

def set_bold(val)
  self.b = RubyXL::BooleanValue.new(:val => val)
end

#set_italic(val) ⇒ Object


33
34
35
# File 'lib/rubyXL/objects/font.rb', line 33

def set_italic(val)
  self.i = RubyXL::BooleanValue.new(:val => val)
end

#set_name(val) ⇒ Object


65
66
67
# File 'lib/rubyXL/objects/font.rb', line 65

def set_name(val)
  self.name = RubyXL::StringValue.new(:val => val)
end

#set_rgb_color(font_color) ⇒ Object

Helper method to modify the font color


82
83
84
# File 'lib/rubyXL/objects/font.rb', line 82

def set_rgb_color(font_color)
  self.color = RubyXL::Color.new(:rgb => font_color.to_s)
end

#set_size(val) ⇒ Object


73
74
75
# File 'lib/rubyXL/objects/font.rb', line 73

def set_size(val)
  self.sz = RubyXL::FloatValue.new(:val => val)
end

#set_strikethrough(val) ⇒ Object


57
58
59
# File 'lib/rubyXL/objects/font.rb', line 57

def set_strikethrough(val)
  self.strike = RubyXL::BooleanValue.new(:val => val)
end

#set_underline(val) ⇒ Object


49
50
51
# File 'lib/rubyXL/objects/font.rb', line 49

def set_underline(val)
  self.u = RubyXL::BooleanValue.new(:val => val)
end