Module: RTF::Converters::HTML::Helpers

Extended by:
Helpers
Included in:
Helpers
Defined in:
lib/rtf/converters/html.rb

Instance Method Summary collapse

Instance Method Details

#font(key) ⇒ Object



49
50
51
52
53
54
# File 'lib/rtf/converters/html.rb', line 49

def font(key)
  RTF::Font.new(*case key
    when :default   then [RTF::Font::ROMAN,  'Times New Roman']
    when :monospace then [RTF::Font::MODERN, 'Courier New'    ]
  end)
end

#style(key) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/rtf/converters/html.rb', line 56

def style(key)
  RTF::CharacterStyle.new.tap do |style|
    case key.to_sym
    when :h1
      style.font_size = 44
      style.bold = true
    when :h2
      style.font_size = 36
      style.bold = true
    when :h3
      style.font_size = 28
      style.bold = true
    when :h4
      style.font_size = 22
      style.bold = true
    end
  end
end