Guide
Defaults
Per-tag attribute defaults — set a value once and every later instance inherits it. Blocks nest in any container and apply positionally, scoped to the content that follows them.
A <defaults> block declares the attribute values a tag should assume when an
instance leaves them out. Each child is an element tag carrying those values —
<text size="11pt"/> makes every later <text> default to that size, so you set
the document's body size once instead of repeating it on every paragraph. It is
the terse counterpart to writing the attribute by hand, and an explicit attribute
on the element always wins.
<defaults>
<text font="serif" size="11pt" color="#222" />
<rect fill="#c4341f" />
</defaults>Where a block can go
A <defaults> block may appear anywhere a child element may:
- in
<config>, for the whole document; - at the top of a
<page>, for that page; - inside any container — a
<box>, a<vertical>, a table<cell>— for the content within it.
It applies positionally, scoped to its parent
A block is not a property of its parent; it is a point in the flow. It restyles the content that follows it among its siblings, and that content's descendants — never what precedes it, and never anything outside its parent. So:
- a later block at the same level overrides an earlier one, for the content after it;
- a block nested in a container scopes to that container — its effect ends where the container does.
This is what makes defaults composable: a section can set its own body size without disturbing the rest of the page, and a sidebar box can pick a smaller size that evaporates the moment the box closes.
It is transparent, not a block
A <defaults> is a directive, not content — it renders nothing and takes no
space. Crucially it is not a block either, so dropping one in the middle of a
paragraph does not break the line: the text after it keeps flowing in the new
style, exactly as a <font> would, just declared once for everything that
follows. The example below is live — edit any size or colour and watch the change
ripple forward, on the same line and into the nested box:
<document version="2.0">
<config>
<page size="A6" margin="22px" />
<defaults>
<text size="10pt" />
</defaults>
</config>
<pages>
<page>
This line starts at the 10pt document default, then
<defaults><text size="15pt" color="#c4341f" /></defaults>
switches to 15pt red right here — same paragraph, no break.
<box background="#f3f1ea" radius="6px" padding="10px">
<defaults><text size="9pt" color="#3c392f" /></defaults>
Inside the box: 9pt grey, scoped — the style ends with the box.
</box>
After the box the 15pt red is still in effect, not the box's 9pt.
</page>
</pages>
</document>Resolution order
An attribute resolves in this order, the first hit winning:
- the attribute written on the element itself;
- the nearest enclosing
<defaults>— walking outward from the element and, at each level, taking the closest block declared before it (innermost and latest first); - the document-wide
<config>defaults; - the element's built-in default.
Defaults cover ordinary attributes only. style:* attributes (background,
border, margin, …) are resolved separately and never read a <defaults> block.
Defaults and bare text
A container's bare text is built as if you had written a
<text>, so it honours <text> defaults too — including a block placed just
before it or wrapping it. Set the body size once and every bare-text cell, box,
and list item picks it up, with no inner <text> to annotate:
<defaults><text font="serif" size="13pt" color="#3c392f" /></defaults>
<box background="#f3f1ea" radius="6px" padding="12px">
No inner <text> here — the cell-style bare text takes the serif face,
13pt size, and warm grey colour straight from the block above.
</box>