Tig 5a4600e3fe Merge branch 'v2_develop' into copilot/fix-e6dde989-9ea1-4d83-8522-54ed8f70815a 1 week ago
..
FormattedText.cs 87c761cd76 Implement new TextFormatter architecture with separated formatter and renderer 2 months ago
ITextFormatter.cs 87c761cd76 Implement new TextFormatter architecture with separated formatter and renderer 2 months ago
ITextRenderer.cs 87c761cd76 Implement new TextFormatter architecture with separated formatter and renderer 2 months ago
NerdFonts.cs c5906c2dc1 #4329—Major Terminal.Gui v2 Architecture Modernization: Application Decoupling, Terminology Improvements, and Nullable Migration (#4338) 3 weeks ago
README.md 0e9068dee7 Add documentation for TextFormatter architectural issues and future rewrite plans 2 months ago
RuneExtensions.cs c5906c2dc1 #4329—Major Terminal.Gui v2 Architecture Modernization: Application Decoupling, Terminology Improvements, and Nullable Migration (#4338) 3 weeks ago
StandardTextFormatter.cs 87c761cd76 Implement new TextFormatter architecture with separated formatter and renderer 2 months ago
StandardTextRenderer.cs 87c761cd76 Implement new TextFormatter architecture with separated formatter and renderer 2 months ago
StringExtensions.cs cd75a20c60 Fixes #4387. Runes should not be used on a cell, but rather should use a single grapheme rendering 1 or 2 columns (#4388) 3 weeks ago
TextDirection.cs c5906c2dc1 #4329—Major Terminal.Gui v2 Architecture Modernization: Application Decoupling, Terminology Improvements, and Nullable Migration (#4338) 3 weeks ago
TextFormatter.cs 5a4600e3fe Merge branch 'v2_develop' into copilot/fix-e6dde989-9ea1-4d83-8522-54ed8f70815a 1 week ago

README.md

Text Formatting in Terminal.Gui

This directory contains text formatting and processing classes for Terminal.Gui.

Classes

TextFormatter

The main text formatting class that handles:

  • Text alignment (horizontal and vertical)
  • Text direction support (left-to-right, right-to-left, top-to-bottom, etc.)
  • Word wrapping
  • Multi-line text support
  • HotKey processing
  • Wide character (Unicode) support

Known Issues: The current TextFormatter implementation has several architectural problems that are planned to be addressed in a future rewrite:

  1. Format/Draw Coupling: The Draw() method does significant formatting work, making FormatAndGetSize() unreliable
  2. Performance: Format() is called multiple times during layout operations
  3. Complex Alignment: Alignment logic is embedded in drawing code instead of using the Aligner engine
  4. Poor Extensibility: Adding new features requires modifying the monolithic class
  5. No Interface: Prevents multiple text formatter implementations

See TextFormatter Rewrite Issue for details.

Other Classes

  • TextDirection: Enumeration for text direction support
  • StringExtensions: Extension methods for string processing
  • RuneExtensions: Extension methods for Unicode Rune processing
  • NerdFonts: Support for Nerd Fonts icons

Future Plans

A complete rewrite of TextFormatter is planned that will:

  • Separate formatting from rendering concerns
  • Provide an interface-based architecture for extensibility
  • Improve performance with better caching
  • Support multiple text formats (HTML, Attributed Text, etc.)
  • Use the Aligner engine for proper alignment

This is a major architectural change planned for a future release.