Text Handling Overview
ProGUI provides a set of functions for creating, configuring, and drawing text within your application's interface. Text rendering is managed through dedicated text objects.
Key functionalities include:
- Text Object Creation: Use CreateText() to create a text object, specifying the initial content, font name, and point size. Optional layout width and height constraints can also be set during creation.
- Content Management: Modify the text content after creation using TextSetContent().
- Formatting & Layout: Control the appearance and layout of the text using various
`TextSet...` commands:
- Alignment & Justification: TextSetAlign() (vertical) and TextSetJustify() (horizontal).
- Font Attributes: TextSetWeight() (boldness), TextSetStyle() (italic/oblique).
- Decorations: TextSetUnderline() and TextSetStrikethrough().
- Wrapping & Trimming: Control how text wraps within layout bounds using TextSetWrap() and how overflowing text is trimmed (e.g., with ellipses) using TextSetTrimming().
- Layout Bounds: Define the maximum width and height for text layout calculations using TextSetWidth() and TextSetHeight().
- Measurement: Retrieve the calculated width and height of the text layout using TextGetWidth() and TextGetHeight().
- Drawing: Render the text object onto the current drawing target using either a solid color (DrawTxt()) or a brush (DrawTxtFill()). Font size is automatically scaled based on the drawing context's DPI.
- Resource Management: Free the resources associated with a text object using FreeText() when it's no longer needed.
Text objects provide an efficient way to handle text rendering, as the layout and formatting information is pre-calculated and cached.