Text
The <Text> element renders styled text content. Text nodes support font
selection, sizing, color, alignment, and underline.
Example
<Text font_size="14" font_name="OpenSans" style="bold"
alignment="center" color="#333333">
Welcome to Docraft
</Text>
Attributes
Attribute |
Type |
Description |
|---|---|---|
|
float |
Font size in points (default |
|
string |
Font family name (default |
|
string |
|
|
string |
|
|
float |
The text’s own box, in points: text is word-wrapped to it and |
|
color |
Text color (hex or named — see Color Values). |
|
bool |
Enable underline rendering. |
|
bool |
Enable strikeout rendering. Independent of |
The text content is the inner text of the XML element.
Word-wrapping is driven by width: given one, the text is wrapped to that box
at measure time, and each resulting line is aligned within it. Without one, the
text is laid out as a single line — it is not wrapped to the container’s natural
width.
<!-- centred on its own 120pt box, not on the parent -->
<Text width="120" alignment="center">Label</Text>
Title & Subtitle
<Title> and <Subtitle> are <Text> variants with larger, bold
defaults and extra margin that tracks the effective font_size — useful
for headings without repeating styling on every <Text>. Every <Text>
attribute above still applies and overrides the defaults.
<Title>Quarterly Report</Title>
<Subtitle font_size="16">Q1 2026</Subtitle>
PageNumber
<PageNumber> is a special text node whose content is automatically
replaced by the current page number at render time. It supports the same
attributes as <Text>.
<Footer>
<PageNumber font_size="10" alignment="center"/>
</Footer>
Paragraph
<Paragraph> groups several <Text> runs into one flowing block — see
Layout for how it composes with <Layout> containers.
<Paragraph line_spacing="1.5" space_before="4" space_after="6" alignment="center">
<Text>First run.</Text>
<Text>Second run, same paragraph.</Text>
</Paragraph>
Attribute |
Type |
Description |
|---|---|---|
|
float |
Line-height multiplier (default |
|
float |
Space above the paragraph in points (default |
|
float |
Space below the paragraph in points (default |
|
string |
Default alignment for children; each |