Class: Gruff::Font

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

Overview

Handle font setting to draw texts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path: nil, size: 20.0, bold: false, color: 'white') ⇒ Font

Returns a new instance of Font.



29
30
31
32
33
34
# File 'lib/gruff/font.rb', line 29

def initialize(path: nil, size: 20.0, bold: false, color: 'white')
  @path = path
  @bold = bold
  @size = size
  @color = color
end

Instance Attribute Details

#boldObject

Get/set font setting whether render bold text.



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

def bold
  @bold
end

#colorObject

Get/set font color.



23
24
25
# File 'lib/gruff/font.rb', line 23

def color
  @color
end

#pathObject

Get/set font path.



14
15
16
# File 'lib/gruff/font.rb', line 14

def path
  @path
end

#sizeObject

Get/set font size.



17
18
19
# File 'lib/gruff/font.rb', line 17

def size
  @size
end

Instance Method Details

#weightMagick::WeightType

Get font weight. TODO: type annotation of return value

Returns:

  • (Magick::WeightType)

    font weight



39
40
41
# File 'lib/gruff/font.rb', line 39

def weight
  @bold ? Magick::BoldWeight : Magick::NormalWeight
end