Class: Font

Inherits:
Object
  • Object
show all
Defined in:
lib/font.rb

Overview

TODO: Need to support an array of font names

... should Font#name return the first available font,
or should it return the array?

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, size = nil) ⇒ Font

Creates a Font object.



10
11
12
13
14
15
16
# File 'lib/font.rb', line 10

def initialize(name=nil, size=nil)
  @name = name || Font.default_name
  @size = size || Font.default_size
  @bold = Font.default_bold
  @italic = Font.default_italic
  @color = Font.default_color
end

Class Attribute Details

.default_boldObject

Returns the value of attribute default_bold.



31
32
33
# File 'lib/font.rb', line 31

def default_bold
  @default_bold
end

.default_colorObject

Returns the value of attribute default_color.



31
32
33
# File 'lib/font.rb', line 31

def default_color
  @default_color
end

.default_italicObject

Returns the value of attribute default_italic.



31
32
33
# File 'lib/font.rb', line 31

def default_italic
  @default_italic
end

.default_nameObject

Returns the value of attribute default_name.



31
32
33
# File 'lib/font.rb', line 31

def default_name
  @default_name
end

.default_sizeObject

Returns the value of attribute default_size.



31
32
33
# File 'lib/font.rb', line 31

def default_size
  @default_size
end

Instance Attribute Details

#boldObject

Returns the value of attribute bold.



7
8
9
# File 'lib/font.rb', line 7

def bold
  @bold
end

#colorObject

Returns the value of attribute color.



7
8
9
# File 'lib/font.rb', line 7

def color
  @color
end

#italicObject

Returns the value of attribute italic.



7
8
9
# File 'lib/font.rb', line 7

def italic
  @italic
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/font.rb', line 7

def name
  @name
end

#sizeObject

Returns the value of attribute size.



7
8
9
# File 'lib/font.rb', line 7

def size
  @size
end

Class Method Details

.exist?(name) ⇒ Boolean

Returns TRUE when the specified font exists within the system.

Returns:

  • (Boolean)


19
20
21
# File 'lib/font.rb', line 19

def self.exist?(name)
  raise "not implemented"
end