In advanced user interface rendering frameworks (such as the Delphi/C++Builder TMS Component Pack), THTMLStaticText is a powerful UI component used to display heavily styled text using HTML tags and CSS properties. It acts as a lightweight HTML layout engine within native desktop frameworks, allowing developers to break away from rigid, single-font text components and create beautiful, responsive typographic designs. Core Concepts of THTMLStaticText Formatting
THTMLStaticText implements inline formatting by parsing standard HTML-like markup directly inside its Text property.
Tag Support: It interprets standard tags like , , , , and (for active, clickable hyperlinks within your layouts).
Block Elements: You can structure text layouts into structured, modern segments using blocks like
(paragraphs) and
Inline CSS: The component uses a style=“…” attribute inside these tags to parse layout instructions, giving developers fine-grained control over local visual hierarchies. Managing Line-Height and Vertical Spacing
Control over vertical spacing is essential when preventing long-form text blocks from bunching up or overlapping. Within THTMLStaticText, you control the vertical rhythm using the line-height style property. Use code with caution. Best Practices for Line-Height Metrics
Unitless Values (line-height: 1.5;): This is the preferred method. It sets a multiplier based directly on the element’s current font-size. If your font size changes dynamically, your line spacing automatically scales proportionally.
Percentage Values (line-height: 150%;): Operates identically to the unitless layout, defining line spacing as a strict percentage of the active font size.
Absolute Pixel Values (line-height: 24px;): Forces a rigid, unyielding line grid. This is only recommended for precise static UI designs where the text content size never alters or scales. Advanced Layout Strategies
Creating production-grade interfaces with THTMLStaticText requires handling complex, multi-element hierarchies. line-height CSS property