Class: RubyXL::Font

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

Overview

Instance Method Summary collapse

Methods inherited from OOXMLObject

define_attribute, define_child_node, define_element_name, #dup, #initialize, obtain_class_variable, parse, set_countable, #write_xml

Constructor Details

This class inherits a constructor from RubyXL::OOXMLObject

Instance Method Details

#==(other) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/rubyXL/objects/font.rb', line 40

def ==(other)
 (!(self.i && self.i.val) == !(other.i && other.i.val)) &&
   (!(self.b && self.b.val) == !(other.b && other.b.val)) &&
   (!(self.u && self.u.val) == !(other.u && other.u.val)) &&
   (!(self.strike && self.strike.val) == !(other.strike && other.strike.val)) &&
   ((self.name && self.name.val) == (other.name && other.name.val)) &&
   ((self.sz && self.sz.val) == (other.sz && other.sz.val)) &&
   (self.color == other.color) # Need to write proper comparison for color
end

#get_nameObject



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

def get_name
  name && name.val
end

#get_rgb_colorObject



98
99
100
# File 'lib/rubyXL/objects/font.rb', line 98

def get_rgb_color
  color && color.rgb
end

#get_sizeObject



90
91
92
# File 'lib/rubyXL/objects/font.rb', line 90

def get_size
  sz && sz.val
end

#is_boldObject



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

def is_bold
  b && b.val
end

#is_italicObject



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

def is_italic
  i && i.val
end

#is_strikethroughObject



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

def is_strikethrough
  strike && strike.val
end

#is_underlinedObject



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

def is_underlined
  u && u.val
end

#set_bold(val) ⇒ Object



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

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

#set_italic(val) ⇒ Object



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

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

#set_name(val) ⇒ Object



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

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



103
104
105
# File 'lib/rubyXL/objects/font.rb', line 103

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

#set_size(val) ⇒ Object



94
95
96
# File 'lib/rubyXL/objects/font.rb', line 94

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

#set_strikethrough(val) ⇒ Object



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

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

#set_underline(val) ⇒ Object



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

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