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.



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

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.



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

def bold
  @bold
end

#colorObject

Get/set font color.



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

def color
  @color
end

#pathObject

Get/set font path.



12
13
14
# File 'lib/gruff/font.rb', line 12

def path
  @path
end

#sizeObject

Get/set font size.



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

def size
  @size
end

Instance Method Details

#weightMagick::WeightType

Get font weight.

Returns:

  • (Magick::WeightType)

    font weight



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

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