Class: OpenXml::Docx::Parts::Fonts

Inherits:
Part
  • Object
show all
Includes:
RootNamespaces
Defined in:
lib/openxml/docx/parts/fonts.rb

Constant Summary

Constants included from RootNamespaces

RootNamespaces::POSSIBLE_NAMESPACES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RootNamespaces

included

Constructor Details

#initializeFonts

Returns a new instance of Fonts.


11
12
13
14
# File 'lib/openxml/docx/parts/fonts.rb', line 11

def initialize
  @fonts = []
  @relationships = OpenXml::Parts::Rels.new
end

Instance Attribute Details

#fontsObject (readonly)

Returns the value of attribute fonts


7
8
9
# File 'lib/openxml/docx/parts/fonts.rb', line 7

def fonts
  @fonts
end

#relationshipsObject (readonly)

Returns the value of attribute relationships


7
8
9
# File 'lib/openxml/docx/parts/fonts.rb', line 7

def relationships
  @relationships
end

Instance Method Details

#<<(font) ⇒ Object


16
17
18
# File 'lib/openxml/docx/parts/fonts.rb', line 16

def <<(font)
  @fonts << font
end

#countObject


20
21
22
# File 'lib/openxml/docx/parts/fonts.rb', line 20

def count
  fonts.count
end

#to_xmlObject


24
25
26
27
28
29
30
31
# File 'lib/openxml/docx/parts/fonts.rb', line 24

def to_xml
  build_standalone_xml do |xml|
    xml.fonts(root_namespaces) {
      xml.parent.namespace = :w
      fonts.each { |font| font.to_xml(xml) }
    }
  end
end