Class: Docxer::Word::Fonts::Font

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ Font

Returns a new instance of Font.



7
8
9
10
# File 'lib/docxer/word/fonts/font.rb', line 7

def initialize(name, options)
  @name = name
  @options = options
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/docxer/word/fonts/font.rb', line 6

def name
  @name
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/docxer/word/fonts/font.rb', line 6

def options
  @options
end

Instance Method Details

#build(xml) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/docxer/word/fonts/font.rb', line 12

def build(xml)
  xml['w'].font('w:name' => @name) do
    xml['w'].panose1('w:val' => @options[:panose] )
    xml['w'].charset('w:val' => @options[:charset] )
    xml['w'].family('w:val' => @options[:family] )
    xml['w'].pitch('w:val' => @options[:pitch] )
    xml['w'].sig( @options[:sig] )
  end
end