lib/wiz_rtf/text.rb in wiz_rtf-0.5.5 vs lib/wiz_rtf/text.rb in wiz_rtf-0.6.0
- old
+ new
@@ -8,16 +8,17 @@
class Text
TEXT_ALIGN_MAP = {left:'ql',center:'qc',right:'qr'}
def initialize(str = '', styles = {})
@str = str
- @styles = {'text-align' => :left, 'font-size' => 24, 'font-bold' => false, 'font-italic' => false, 'font-underline' => false, 'foreground-color' => 1, 'background-color' => 0 }.merge(styles)
+ @styles = {'text-align' => :left, 'font-family' => 0, 'font-size' => 24, 'font-bold' => false, 'font-italic' => false, 'font-underline' => false, 'foreground-color' => 0, 'background-color' => 0 }.merge(styles)
end
def render(io)
io.group do
io.cmd :pard
io.cmd TEXT_ALIGN_MAP[@styles['text-align']]
+ io.cmd :f, @styles['font-family']
io.cmd :fs, @styles['font-size']
io.cmd @styles['font-bold'] ? 'b' : 'b0'
io.cmd @styles['font-italic'] ? 'i' : 'i0'
io.cmd @styles['font-underline'] ? 'ul' : 'ulnone'
io.cmd :cf, @styles['foreground-color']