Package org.fife.ui.rsyntaxtextarea

## Class RtfGenerator

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

-     public class RtfGenerator
      extends 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 | Description
    --- | ---
    `RtfGenerator()` | Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `appendNewline()` | Adds a newline to the RTF document.
    `void` | `appendToDoc​(String text, Font f, Color fg, Color bg)` | Appends styled text to the RTF document being generated.
    `void` | `appendToDoc​(String text, Font f, Color fg, Color bg, boolean underline)` | Appends styled text to the RTF document being generated.
    `void` | `appendToDoc​(String text, Font f, Color fg, Color bg, boolean underline, boolean setFG)` | Appends styled text to the RTF document being generated.
    `void` | `appendToDocNoFG​(String text, Font f, Color bg, boolean underline)` | Appends styled text to the RTF document being generated.
    `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​(String text,
                                  Font f,
                                  Color fg,
                                  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​(String text,
                                      Font f,
                                      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​(String text,
                                  Font f,
                                  Color fg,
                                  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​(String text,
                                  Font f,
                                  Color fg,
                                  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 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.