Class DoubleSizeCharacters

java.lang.Object
org.jline.terminal.impl.DoubleSizeCharacters

public class DoubleSizeCharacters extends Object
Utility class for handling double-size characters in terminals.

Double-size characters are a feature supported by some terminals that allows displaying text at double width and/or double height. This is useful for creating banners, headers, or emphasizing important text.

The implementation uses VT100-compatible escape sequences: - ESC # 3: Double-height, double-width line (top half) - ESC # 4: Double-height, double-width line (bottom half) - ESC # 5: Single-width, single-height line (normal) - ESC # 6: Double-width, single-height line

  • Constructor Details

    • DoubleSizeCharacters

      public DoubleSizeCharacters()
      Creates a new DoubleSizeCharacters instance.
  • Method Details

    • isDoubleSizeSupported

      public static boolean isDoubleSizeSupported(Terminal terminal)
      Checks if the terminal supports double-size characters.
      Parameters:
      terminal - the terminal to check
      Returns:
      true if the terminal supports double-size characters, false otherwise
    • setMode

      public static void setMode(Terminal terminal, DoubleSizeCharacters.Mode mode) throws IOException
      Sets the double-size character mode for the current line.
      Parameters:
      terminal - the terminal to write to
      mode - the double-size mode to set
      Throws:
      IOException - if an I/O error occurs
    • printNormal

      public static void printNormal(Terminal terminal, String text) throws IOException
      Prints text in normal size.
      Parameters:
      terminal - the terminal to write to
      text - the text to print
      Throws:
      IOException - if an I/O error occurs
    • printDoubleWidth

      public static void printDoubleWidth(Terminal terminal, String text) throws IOException
      Prints text in double width.
      Parameters:
      terminal - the terminal to write to
      text - the text to print
      Throws:
      IOException - if an I/O error occurs
    • printDoubleHeight

      public static void printDoubleHeight(Terminal terminal, String text) throws IOException
      Prints text in double height (both top and bottom halves). This method automatically handles printing both the top and bottom halves of double-height text.
      Parameters:
      terminal - the terminal to write to
      text - the text to print
      Throws:
      IOException - if an I/O error occurs
    • printBanner

      public static void printBanner(Terminal terminal, String text, char borderChar) throws IOException
      Creates a banner with the specified text using double-height characters. This is useful for creating prominent headers or titles.
      Parameters:
      terminal - the terminal to write to
      text - the text for the banner
      borderChar - the character to use for the border (e.g., '*', '=', '-')
      Throws:
      IOException - if an I/O error occurs
    • reset

      public static void reset(Terminal terminal) throws IOException
      Resets the terminal to normal character size. This is useful to ensure the terminal is in a known state.
      Parameters:
      terminal - the terminal to reset
      Throws:
      IOException - if an I/O error occurs