Skip to main content

Text Property Tags

Override font size, color, alignment, and vertical position within any text element (p, th, td, li, h1–h6).

Font size​

Override the font size for a span, specified in points.

{ "p": "Normal text [fontsize, 18]large text[/fontsize] normal again." }

Short form: [size, 18]...[/size]

The size is a bare number of points (18) or a length with a unit: pt, in, mm or px (18pt, 6mm). It must be above 0 and at most 1638pt, the fontSize style key's bound; anything else is an ERROR and the run keeps the size in force.

A run set larger than its paragraph makes its line taller, as it does in CSS: with lineHeight as a number the line takes that number times the run's own size, so an 18pt run in a paragraph at 1.4 gets a 25.2pt line. With lineHeight as a length ("14pt") the lines keep that pitch and the larger letters reach into the line above: use a length when the lines must stay on an even grid. The same holds for a size set through a [span, style].

Example: fine print disclaimer​

{ "p": "I agree to the [fontsize, 7]terms and conditions as outlined in section 4.2 of the master agreement[/fontsize]." }

Font color​

Change the text color using any CSS color: a hex code, rgb(), or a named color.

{ "p": "Status: [color, #27AE60]Active[/color]" }

Also accepted: [fontcolor, #27AE60]...[/fontcolor]

Supported color formats​

The forms are those of CSS Color 4:

FormatExample
Hex (3, 4, 6 or 8 digits, with #; the 4th and 8th digits are alpha)#F53, #FF5733, #FF573380
Hex (6 or 8 digits, no #)FF5733
rgb() / rgba()rgb(255 87 51), rgba(255, 87, 51, 0.5)
Named colorsred, cornflowerblue, rebeccapurple, darkslategray, tomato, …
transparenttransparent

The CSS named-color set (148 entries) is fully supported — anything from the W3C named-color reference including British spellings (grey, darkgrey, lightgrey, dimgrey, darkslategrey, slategrey, lightslategrey). Names are case-insensitive.

A value that is not a color is an ERROR, and the run keeps the color in force. The tag reads colors exactly as the style keys do; Paint has the full color syntax, device-cmyk() included.

Example: status indicators​

{ "p": "Build: [color, #27AE60]PASSING[/color] · Coverage: [color, #F39C12]87%[/color] · Issues: [color, #E74C3C]3 open[/color]" }

Text alignment​

The tag sets the alignment of the whole paragraph, from the first run that carries it. Its values are those of the textAlign style key, which is usually the better place to set it.

ValueAlignment
startThe start edge of the text direction: left in left-to-right text, right in right-to-left text
endThe end edge of the text direction
leftLeft
centerCenter
rightRight
justifyJustified: every line but the last fills the width
{ "p": "[align, center]This paragraph is centered.[/align]" }
{ "p": "[align, end]Signature line at the end edge[/align]" }

Superscript​

Raise text above the baseline — useful for exponents and ordinals. For a numbered footnote, use [note], which numbers the mark and sets the note at the page foot.

{ "p": "Area: 100m[sup]2[/sup]" }

Long form: [superscript]...[/superscript]

The tag takes no argument. It raises the run by 0.33 em and steps its size down to CSS smaller (the HTML user-agent stylesheet's sub, sup { font-size: smaller }): 1/1.2 of the size in force, so a superscript in 12pt text is 10pt. The step is taken from the surrounding size, so [fontsize, 18][sup]...[/sup][/fontsize] steps down from 18pt. A [fontsize] inside the run states the size outright and no step applies.

In a tagged PDF the run is marked as a superscript, so a screen reader announces it as one.

The face's own superscript forms

[sup] and [sub] always reduce and shift the run. Many text faces carry superscript and subscript figures of their own, designed to sit at the right weight and keep the line's height: ask for them with the fontVariantPosition style key (super or sub) through a [span, style]. Where the face has no form for every character of the run, the whole run is reduced and raised as [sup] draws it. See Typography.

{
"styles": { "unit": { "fontVariantPosition": "super" } },
"content": [
{ "p": "Floor area: 120 m[span, unit]2[/span]" }
]
}

Example: chemical formulas and footnotes​

{ "p": "Revenue increased by 23%[sup]1[/sup] compared to Q3[sup]2[/sup]." }

Subscript​

Lower text below the baseline — useful for chemical formulas and indices.

{ "p": "Water: H[sub]2[/sub]O · Carbon dioxide: CO[sub]2[/sub]" }

Long form: [subscript]...[/subscript]

The tag takes no argument. It lowers the run by 0.18 em and steps its size down exactly as [sup] does.

Letter spacing​

Tighten or widen the spacing between characters, in points. Negative values condense, positive values track out — useful for caps-on-display headlines, eyebrow text, and brand wordmarks.

{ "p": "[ls, 1.5]E X E C U T I V E S U M M A R Y[/ls]" }

Short form: [ls, 1.5]...[/ls] · Long form: [letterspacing, 1.5]...[/letterspacing]

Accepts the same length input as fontsize — a bare number of points (1.5) or a number with a unit: pt, in, mm or px (1.5pt).

Example: tracked-out section heading​

{ "p": "[b][fontsize, 9][color, #888888][ls, 2]CONFIDENTIAL DRAFT[/ls][/color][/fontsize][/b]" }

Highlight​

Apply a colored background to a span of text — like a marker on print, or the <mark> element in HTML.

{ "p": "Read the [hl, yellow]highlighted clause[/hl] carefully." }

Short form: [hl, color]...[/hl] · Long form: [highlight, color]...[/highlight]

Accepts any CSS color the font color does — hex (#FFEB3B), rgb(), or a named color (yellow, lightcyan, palegoldenrod, …). The color is optional: [hl]...[/hl] and [highlight]...[/highlight] alone paint #fef08a.

A color with alpha (rgba(), an 8-digit hex) lets the text's backdrop show through in the PDF:

{ "p": "Read the [hl, rgba(255, 213, 0, 0.35)]translucent highlight[/hl] carefully." }

The DOCX cannot carry alpha in a run's shading: it writes the color as it looks over the white page, and reports the blend with a NOTICE.

HTML alias: [mark]​

[mark]...[/mark] is the HTML-semantic shorthand for a default-yellow highlight — equivalent to [hl, #fef08a]...[/hl]; [hl] and [highlight] with no color give the same yellow. Like every span, the innermost tag wins: a [mark] inside an [hl, color] paints its own words yellow.

{ "p": "Confirm the [mark]closing date[/mark] before signing." }

Example: review markers​

{ "p": "Status: [hl, #FFEB3B]NEEDS REVIEW[/hl] · Owner: [hl, #C8E6C9]Alice[/hl]" }

Combining with typography​

Text property tags nest with typography tags:

{ "p": "[b][color, #CC0000]CRITICAL[/color][/b]: Server [fontsize, 8]$data.server.id[/fontsize] is [i]unreachable[/i]." }
{ "p": "Price: [b][fontsize, 20]$data.price[/fontsize][/b] [color, #999999][fontsize, 9]per unit[/fontsize][/color]" }