Class: Prawn::SVG::Font

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, weight, style, stretch = nil) ⇒ Font

Returns a new instance of Font.



5
6
7
8
9
10
# File 'lib/prawn/svg/font.rb', line 5

def initialize(name, weight, style, stretch = nil)
  @name = name
  @weight = weight
  @style = style
  @stretch = stretch
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/prawn/svg/font.rb', line 3

def name
  @name
end

#stretchObject (readonly)

Returns the value of attribute stretch.



3
4
5
# File 'lib/prawn/svg/font.rb', line 3

def stretch
  @stretch
end

#styleObject (readonly)

Returns the value of attribute style.



3
4
5
# File 'lib/prawn/svg/font.rb', line 3

def style
  @style
end

#weightObject (readonly)

Returns the value of attribute weight.



3
4
5
# File 'lib/prawn/svg/font.rb', line 3

def weight
  @weight
end

Instance Method Details

#subfamilyObject



12
13
14
15
16
17
18
# File 'lib/prawn/svg/font.rb', line 12

def subfamily
  parts = []
  parts << stretch if stretch && stretch != :normal
  parts << weight if weight && weight != :normal
  parts << style if style
  parts.empty? ? :normal : parts.join('_').to_sym
end