API Reference
Class
DisplayWidth
Deterministic Unicode 17.0 cell widths and terminal grapheme segmentation across all supported runtimes.
Inheritance
- Object
- DisplayWidth
Methods
Cells 2 overloads
public static IEnumerable<TextCell> Cells(String? text) #Returns:
IEnumerable<TextCell>Groups base characters with marks, selectors, modifiers and joined sequences. Standalone zero-width clusters are omitted.
Parameters
- text System.String?
- Text, or null for no cells.
Returns
Visible graphemes and their cell widths. Control characters are omitted.
public static IEnumerable<TextCell> Cells(String? text, TerminalWidthProfile profile) #Returns:
IEnumerable<TextCell>Groups visible graphemes using an explicit width profile.
Parameters
- text System.String?
- profile ConsoleMonster.Text.TerminalWidthProfile
GetWidth 2 overloads
public static Int32 GetWidth(Int32 codePoint) #Returns:
Int32Returns 0 for combining/format/control characters, 2 for wide or default emoji characters, otherwise 1.
Parameters
- codePoint System.Int32
- Unicode scalar value. Invalid values occupy one replacement cell.
Returns
0, 1 or 2.
public static Int32 GetWidth(Int32 codePoint, TerminalWidthProfile profile) #Returns:
Int32Returns the scalar cell width under a terminal profile.
Parameters
- codePoint System.Int32
- profile ConsoleMonster.Text.TerminalWidthProfile
Measure 2 overloads
public static Int32 Measure(String? text) #Returns:
Int32Measures terminal cells, counting each emoji or ZWJ sequence once.
Parameters
- text System.String?
- Text, or null for zero width.
Returns
The display width.
public static Int32 Measure(String? text, TerminalWidthProfile profile) #Returns:
Int32Measures terminal cells with an explicit width profile.
Parameters
- text System.String?
- profile ConsoleMonster.Text.TerminalWidthProfile
Inherited Methods
public virtual Boolean Equals(Object? obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object?
Properties
public static TerminalWidthProfile Profile { get; set; } #The process-wide terminal width model used by existing overloads.