Method: RTF::CommandNode#font
- Defined in:
- lib/rtf/node.rb
#font(font, size = nil) ⇒ Object
This method provides a short cut means of creating a font command node. The method accepts a block that will be passed a single parameter which will be a reference to the font node created. After the block is complete the font node is appended to the end of the child nodes on the object that the method is called against.
Parameters
- font
-
A reference to font object that represents the font to be used within the node.
- size
-
An integer size setting for the font. Defaults to nil to indicate that the current font size should be used.
487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/rtf/node.rb', line 487 def font(font, size=nil) style = CharacterStyle.new style.font = font style.font_size = size root.fonts << font if block_given? apply(style) {|node| yield node} else apply(style) end end |