- java.lang.Object
-
- org.jline.terminal.impl.DoubleSizeCharacters
-
public class DoubleSizeCharacters extends java.lang.ObjectUtility 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDoubleSizeCharacters.ModeEnumeration of double-size character modes.
-
Constructor Summary
Constructors Constructor Description DoubleSizeCharacters()Creates a new DoubleSizeCharacters instance.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisDoubleSizeSupported(Terminal terminal)Checks if the terminal supports double-size characters.static voidprintBanner(Terminal terminal, java.lang.String text, char borderChar)Creates a banner with the specified text using double-height characters.static voidprintDoubleHeight(Terminal terminal, java.lang.String text)Prints text in double height (both top and bottom halves).static voidprintDoubleWidth(Terminal terminal, java.lang.String text)Prints text in double width.static voidprintNormal(Terminal terminal, java.lang.String text)Prints text in normal size.static voidreset(Terminal terminal)Resets the terminal to normal character size.static voidsetMode(Terminal terminal, DoubleSizeCharacters.Mode mode)Sets the double-size character mode for the current line.
-
-
-
Method Detail
-
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 java.io.IOException
Sets the double-size character mode for the current line.- Parameters:
terminal- the terminal to write tomode- the double-size mode to set- Throws:
java.io.IOException- if an I/O error occurs
-
printNormal
public static void printNormal(Terminal terminal, java.lang.String text) throws java.io.IOException
Prints text in normal size.- Parameters:
terminal- the terminal to write totext- the text to print- Throws:
java.io.IOException- if an I/O error occurs
-
printDoubleWidth
public static void printDoubleWidth(Terminal terminal, java.lang.String text) throws java.io.IOException
Prints text in double width.- Parameters:
terminal- the terminal to write totext- the text to print- Throws:
java.io.IOException- if an I/O error occurs
-
printDoubleHeight
public static void printDoubleHeight(Terminal terminal, java.lang.String text) throws java.io.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 totext- the text to print- Throws:
java.io.IOException- if an I/O error occurs
-
printBanner
public static void printBanner(Terminal terminal, java.lang.String text, char borderChar) throws java.io.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 totext- the text for the bannerborderChar- the character to use for the border (e.g., '*', '=', '-')- Throws:
java.io.IOException- if an I/O error occurs
-
reset
public static void reset(Terminal terminal) throws java.io.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:
java.io.IOException- if an I/O error occurs
-
-