RtfGenerator
Date: 2017-02-11

org.fife.ui.rsyntaxtextarea

## Class RtfGenerator

- java.lang.Object
- - org.fife.ui.rsyntaxtextarea.RtfGenerator

-     public class RtfGenerator
      extends java.lang.Object

  Generates RTF text via a simple Java API.

  The following RTF features are supported:

  - Fonts
  - Font sizes
  - Foreground and background colors
  - Bold, italic, and underline
  The RTF generated isn't really "optimized," but it will do, especially for small amounts of text, such as what's common when copy-and-pasting. It tries to be sufficient for the use case of copying syntax highlighted code:
  - It assumes that tokens changing foreground color often is fairly common.
  - It assumes that background highlighting is fairly uncommon.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RtfGenerator()` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendNewline()` Adds a newline to the RTF document.
    `void` | `appendToDoc(java.lang.String text, java.awt.Font f, java.awt.Color fg, java.awt.Color bg)` Appends styled text to the RTF document being generated.
    `void` | `appendToDoc(java.lang.String text, java.awt.Font f, java.awt.Color fg, java.awt.Color bg, boolean underline)` Appends styled text to the RTF document being generated.
    `void` | `appendToDoc(java.lang.String text, java.awt.Font f, java.awt.Color fg, java.awt.Color bg, boolean underline, boolean setFG)` Appends styled text to the RTF document being generated.
    `void` | `appendToDocNoFG(java.lang.String text, java.awt.Font f, java.awt.Color bg, boolean underline)` Appends styled text to the RTF document being generated.
    `java.lang.String` | `getRtf()` Returns the RTF document created by this generator.
    `void` | `reset()` Resets this generator.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### RtfGenerator

          public RtfGenerator()

      Constructor.

  - ### Method Detail

    - #### appendNewline

          public void appendNewline()

      Adds a newline to the RTF document.
      See Also:
        `appendToDoc(String, Font, Color, Color)`

    - #### appendToDoc

          public void appendToDoc(java.lang.String text,
                         java.awt.Font f,
                         java.awt.Color fg,
                         java.awt.Color bg)

      Appends styled text to the RTF document being generated.
      Parameters:
        `text` - The text to append.
        `f` - The font of the text. If this is `null`, the default font is used.
        `fg` - The foreground of the text. If this is `null`, the default foreground color is used.
        `bg` - The background color of the text. If this is `null`, the default background color is used.
      See Also:
        `appendNewline()`

    - #### appendToDocNoFG

          public void appendToDocNoFG(java.lang.String text,
                             java.awt.Font f,
                             java.awt.Color bg,
                             boolean underline)

      Appends styled text to the RTF document being generated.
      Parameters:
        `text` - The text to append.
        `f` - The font of the text. If this is `null`, the default font is used.
        `bg` - The background color of the text. If this is `null`, the default background color is used.
        `underline` - Whether the text should be underlined.
      See Also:
        `appendNewline()`

    - #### appendToDoc

          public void appendToDoc(java.lang.String text,
                         java.awt.Font f,
                         java.awt.Color fg,
                         java.awt.Color bg,
                         boolean underline)

      Appends styled text to the RTF document being generated.
      Parameters:
        `text` - The text to append.
        `f` - The font of the text. If this is `null`, the default font is used.
        `fg` - The foreground of the text. If this is `null`, the default foreground color is used.
        `bg` - The background color of the text. If this is `null`, the default background color is used.
        `underline` - Whether the text should be underlined.
      See Also:
        `appendNewline()`

    - #### appendToDoc

          public void appendToDoc(java.lang.String text,
                         java.awt.Font f,
                         java.awt.Color fg,
                         java.awt.Color bg,
                         boolean underline,
                         boolean setFG)

      Appends styled text to the RTF document being generated.
      Parameters:
        `text` - The text to append.
        `f` - The font of the text. If this is `null`, the default font is used.
        `fg` - The foreground of the text. If this is `null`, the default foreground color is used.
        `bg` - The background color of the text. If this is `null`, the default background color is used.
        `underline` - Whether the text should be underlined.
        `setFG` - Whether the foreground specified by `fg` should be honored (if it is non-`null`).
      See Also:
        `appendNewline()`

    - #### getRtf

          public java.lang.String getRtf()

      Returns the RTF document created by this generator.
      Returns:
        The RTF document, as a `String`.

    - #### reset

          public void reset()

      Resets this generator. All document information and content is cleared.