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 |
|
|
color |
Text color (hex or named). |
|
bool |
Enable underline rendering. |
|
bool |
Enable strikeout rendering. Independent of |
The text content is the inner text of the XML element. Note there is
currently no Craft Language attribute for word-wrapping (the underlying
DocraftLoomText::wrap_width() isn’t wired to an XML token yet) — text
that doesn’t fit its container’s natural width is not wrapped from markup.
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 |