Hyper Text Rendering (hApi + HTextRendering)
- Plain Text (Windows API)
- Hyper Text Rendering (HTextRendering)
- HTML ⇄ Hyper Text Conversion
HTextDimensions
Measures text dimensions with current canvas font settings.Function HTextDimensions(CONST Canvas: TCanvas; CONST Text: String; Inc_Pixel: Boolean = True): TSize;
Parameters
- Canvas: TCanvas; measurement canvas.
- Text: String; text to measure.
- Inc_Pixel: Boolean; adds extra pixel when True.
Return Value
Returns calculated text size.HDrawText
Draws text using Windows draw-text flags for low-level control.Procedure HDrawText(CONST Canvas: TCanvas; CONST Text: String; Rect: TRect; CONST Flags: Cardinal);
Parameters
- Canvas: TCanvas; drawing surface.
- Text: String; text to render.
- Rect: TRect; draw rectangle.
- Flags: Cardinal; draw flags (DT_*).
HDrawText_SL
Draws text with simplified horizontal/vertical alignment arguments.Procedure HDrawText_SL(CONST Canvas: TCanvas; CONST Text: String; Rect: TRect; CONST Halign, Valign: Byte);
Parameters
- Canvas: TCanvas; drawing surface.
- Text: String; text to render.
- Rect: TRect; draw rectangle.
- Halign: Byte; horizontal alignment.
- Valign: Byte; vertical alignment.
HSmart_DrawText
Draws Hyper Text (Hapi-tagged text) on a canvas with horizontal and vertical alignment control.Returns the size of the rendered text area.
This API is a direct bridge to
Render_Text_On_Canvas
in the engine with identical parameters.Function HSmart_DrawText(CONST Canvas: TCanvas; CONST Text: String; CONST Rect: TRect; CONST HAlign, VAlign: Byte): TSize;
Parameters
- Canvas: TCanvas; the canvas on which to draw text.
- Text: String; Hyper Text / tagged text to render.
- Rect: TRect; bounding rectangle for rendering.
- HAlign: Byte; horizontal alignment code.
- VAlign: Byte; vertical alignment code.
Return Value
Returns the size occupied by the rendered text.HSmart_Text_Dimensions
Measures Hyper Text (Hapi-tagged text) dimensions using a fixed width constraint.Function HSmart_Text_Dimensions(CONST Canvas: TCanvas; CONST Text: String; CONST FixedWidth: Integer): TSize;
Parameters
- Canvas: TCanvas; the canvas used for measuring text.
- Text: String; Hyper Text / tagged text content to measure.
- FixedWidth: Integer; width used for line wrapping.
Return Value
Returns required width/height for the text block.Convert_Html_Body_To_Hapi_Tagged_Text
Converts HTML body text into Hapi tagged text format.Function Convert_Html_Body_To_Hapi_Tagged_Text(Html: String): String;
Parameters
- Html: String; source HTML content.
Return Value
Returns converted Hapi-tagged text.Convert_Hapi_Tagged_Text_To_Html
Converts Hapi tagged text back into HTML markup.Function Convert_Hapi_Tagged_Text_To_Html(Text: String): String;
Parameters
- Text: String; Hapi tagged source text.
Return Value
Returns generated HTML text.Convert_Chars_From_Unicode_To_Html
Converts Unicode text to HTML-safe output, with optional CR-to-BR conversion.Function Convert_Chars_From_Unicode_To_Html(Original_Unicode16: String; Convert_CR_To_BR: Boolean = True): String;
Parameters
- Original_Unicode16: String; source Unicode text.
- Convert_CR_To_BR: Boolean; converts CR/LF to <br> when True.
Return Value
Returns HTML-escaped text.Does_Html_Need_To_Be_RtL
Detects whether HTML output should be rendered as right-to-left.Function Does_Html_Need_To_Be_RtL(Text: String): Boolean;
Parameters
- Text: String; text to analyze.
Return Value
Returns True for RTL-oriented text.Returns False otherwise.