lib/rtf/style.rb
def prefix(fonts, colours)
         text = StringIO.new

         text << '\b' if @bold
         text << '\i' if @italic
         text << '\ul' if @underline
         text << '\super' if @superscript
         text << '\caps' if @capitalise
         text << '\strike' if @strike
         text << '\sub' if @subscript
         text << '\v' if @hidden
         text << "\\cf#{colours.index(@foreground)}" if @foreground != nil
         text << "\\cb#{colours.index(@background)}" if @background != nil
         text << "\\f#{fonts.index(@font)}" if @font != nil
         text << "\\fs#{@font_size.to_i}" if @font_size != nil
         text << '\rtlch' if @flow == RIGHT_TO_LEFT

         text.string.length > 0 ? text.string : nil
      end
def prefix(fonts, colours)
         text = StringIO.new

         text << '\b' if @bold
         text << '\i' if @italic
         text << '\ul' if @underline
         text << '\super' if @superscript
         text << '\caps' if @capitalise
         text << '\strike' if @strike
         text << '\sub' if @subscript
         text << '\v' if @hidden
         text << "\\cf#{colours.index(@foreground)}" if @foreground != nil
         text << "\\cb#{colours.index(@background)}" if @background != nil
         text << "\\f#{fonts.index(@font)}" if @font != nil
         text << "\\fs#{@font_size.to_i}" if @font_size != nil
         text << '\rtlch' if @flow == RIGHT_TO_LEFT

         text.string.length > 0 ? text.string : nil
      end
def prefix ( fonts , colours ) text = StringIO . new text << '\b' if @bold text << '\i' if @italic text << '\ul' if @underline text << '\super' if @superscript text << '\caps' if @capitalise text << '\strike' if @strike text << '\sub' if @subscript text << '\v' if @hidden text << "\\cf#{colours.index(@foreground)}" if @foreground != nil text << "\\cb#{colours.index(@background)}" if @background != nil text << "\\f#{fonts.index(@font)}" if @font != nil text << "\\fs#{@font_size.to_i}" if @font_size != nil text << '\rtlch' if @flow == RIGHT_TO_LEFT text . string . length > 0 ? text . string : nil end
This method generates a string containing the prefix associated with a
 style object.

 ==== Parameters
 fonts::    A reference to a FontTable containing any fonts used by the
            style (may be nil if no fonts used).
 colours::  A reference to a ColourTable containing any colours used by
            the style (may be nil if no colours used).
This method generates a string containing the prefix associated with a style object .