Class: Font

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

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = Font.default_name, size = Font.default_size) ⇒ Font

Returns a new instance of Font.



30
31
32
33
34
35
36
37
38
39
# File 'lib/rgss3/font.rb', line 30

def initialize(name = Font.default_name, size = Font.default_size)
  @name = name.dup
  @size = size
  @bold = Font.default_bold
  @italic = Font.default_italic
  @shadow = Font.default_shadow
  @outline = Font.default_outline
  @color = Font.default_color.dup
  @out_color = Font.default_out_color.dup
end

Class Attribute Details

.default_boldObject

Returns the value of attribute default_bold.



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

def default_bold
  @default_bold
end

.default_colorObject

Returns the value of attribute default_color.



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

def default_color
  @default_color
end

.default_italicObject

Returns the value of attribute default_italic.



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

def default_italic
  @default_italic
end

.default_nameObject

Returns the value of attribute default_name.



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

def default_name
  @default_name
end

.default_out_colorObject

Returns the value of attribute default_out_color.



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

def default_out_color
  @default_out_color
end

.default_outlineObject

Returns the value of attribute default_outline.



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

def default_outline
  @default_outline
end

.default_shadowObject

Returns the value of attribute default_shadow.



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

def default_shadow
  @default_shadow
end

.default_sizeObject

Returns the value of attribute default_size.



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

def default_size
  @default_size
end

Instance Attribute Details

#boldObject

Returns the value of attribute bold.



28
29
30
# File 'lib/rgss3/font.rb', line 28

def bold
  @bold
end

#colorObject

Returns the value of attribute color.



28
29
30
# File 'lib/rgss3/font.rb', line 28

def color
  @color
end

#italicObject

Returns the value of attribute italic.



28
29
30
# File 'lib/rgss3/font.rb', line 28

def italic
  @italic
end

#nameObject

Returns the value of attribute name.



28
29
30
# File 'lib/rgss3/font.rb', line 28

def name
  @name
end

#out_colorObject

Returns the value of attribute out_color.



28
29
30
# File 'lib/rgss3/font.rb', line 28

def out_color
  @out_color
end

#outlineObject

Returns the value of attribute outline.



28
29
30
# File 'lib/rgss3/font.rb', line 28

def outline
  @outline
end

#shadowObject

Returns the value of attribute shadow.



28
29
30
# File 'lib/rgss3/font.rb', line 28

def shadow
  @shadow
end

#sizeObject

Returns the value of attribute size.



28
29
30
# File 'lib/rgss3/font.rb', line 28

def size
  @size
end

Class Method Details

.exist?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

def exist?(name)
  f = (Gosu::Font.new(Graphics.gosu_window, "./Fonts/#{name}.ttf", 8) rescue false)
  Gosu::Font.new(Graphics.gosu_window, name, 8) unless f
  return true
rescue
  return false
end

Instance Method Details

#first_existant_nameObject

NEW



43
44
45
46
47
48
49
50
# File 'lib/rgss3/font.rb', line 43

def first_existant_name
  if @name.is_a?(Array)
    @name.each {|a| return a if Font.exist?(a) }
  else
    return @name if Font.exist?(@name)
  end
  return "Verdana"
end