# `<text>`

[Canonical page](https://nothing.graphics/docs/format/reference/text) · [Page source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/docs/reference/text.md)

Lay out editable Unicode copy as glyph geometry for a shape.

## Examples

[Download the complete .nothing source](https://nothing.graphics/format/editable-caption/source.nothing) · [Source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/conformance/fonts/caption.nothing)

Rendered with ncf-preview at 120 × 80.

Bound resources

- [fixtures/fonts/PT_Serif/PTSerif-Regular.ttf](https://github.com/gridaco/fixtures/blob/main/fonts/PT_Serif/PTSerif-Regular.ttf) for `PT Serif@400`
- [ncf/conformance/attached-drawables/arithmetic.ttf](https://github.com/gridaco/nothing/blob/main/ncf/conformance/attached-drawables/arithmetic.ttf) for `NCF Arithmetic@400`

- [Still · Wrapped caption](https://nothing.graphics/format/editable-caption/0.webp) at 0s. The two square primary glyphs share the first baseline. The two Cyrillic characters use the fallback face and wrap to the second baseline.

```xml
  <shape>
    <text x="4" y="24" font-family="NCF Arithmetic" font-size="20" inline-size="44" line-height="26">AA ЖЖ</text>
    <fill><paint><solid color="#FFFFFFFF"/></paint></fill>
  </shape>
```



<!-- Generated by ncf/tools/reference/generate.mjs. -->

A text element owns paragraph settings and copy. It contributes glyph outlines to the owning shape. Direct copy and child spans join without extra separators.

## Syntax [#syntax]

### Keep a caption centered through a copy change [#keep-a-caption-centered-through-a-copy-change]

Set the line anchor to x = 160 and the first baseline to y = 128. With PT Serif Regular and Bold bound, seek to frame 24 for “Status WAIT.” Narrow the inline size to 90 and the lines center separately at baselines 128 and 158.

```xml
<text x="160" y="128" text-anchor="middle" font-family="PT Serif" font-size="24" inline-size="288" line-height="30">Status <span font-weight="700">READY<fill><paint><solid color="#2060E0FF">
    <animate attributeName="color" fill="freeze">
      <key frame="0" value="#2060E0FF" ease="linear"/>
      <key frame="24" value="#60C080FF"/>
    </animate>
  </solid></paint></fill><animate attributeName="value" fill="freeze">
    <key frame="0" value="READY" ease="hold"/>
    <key frame="24" value="WAIT"/>
  </animate></span>.</text>
```

[Complete .nothing source](https://github.com/gridaco/nothing/blob/main/ncf/examples/composition-card.nothing) · [Sample checks](https://github.com/gridaco/nothing/blob/main/ncf/conformance/composition-card.md)

## Usage context [#usage-context]

Allowed parents are [`<shape>`](https://nothing.graphics/docs/format/reference/shape).

Inherits from [Geometry](https://nothing.graphics/docs/format/reference/geometry).

Includes [Text copy](https://nothing.graphics/docs/format/reference/text-copy).

Character data beside span or animation children, including indentation, is significant. Resolve [font input and fallback](https://nothing.graphics/docs/format/spec/fonts#face-selection-and-fallback) before sampling geometry or paint.

## Attributes [#attributes]

[Property animation](https://nothing.graphics/docs/format/spec/animation#property-types-and-exceptions)

### `x` [#x]

**Value** local units · **If omitted** `0` · **Keys** Scalar

Horizontal anchor for each line. [Typeface and paragraph](https://nothing.graphics/docs/format/spec/text#typeface-and-paragraph)

### `y` [#y]

**Value** local units · **If omitted** `0` · **Keys** Scalar

Vertical position of the first alphabetic baseline. [Typeface and paragraph](https://nothing.graphics/docs/format/spec/text#typeface-and-paragraph)

### `font-family` [#font-family]

**Value** `One nonempty family name` · **Required** · **Keys** Held

Requested family resolved in the sample's font environment. [Authored font requests](https://nothing.graphics/docs/format/spec/fonts#authored-request)

### `font-size` [#font-size]

**Value** local units · **Required** · **Keys** Scalar

Positive em size. [Typeface and paragraph](https://nothing.graphics/docs/format/spec/text#typeface-and-paragraph)

### `font-weight` [#font-weight]

**Value** `Exact integer from 1 to 1000` · **If omitted** `400` · **Keys** Held

Requested face weight. [Authored font requests](https://nothing.graphics/docs/format/spec/fonts#authored-request)

### `text-anchor` [#text-anchor]

**Value** `start`, `middle`, `end` · **If omitted** `start` · **Keys** Held

Align each line's advance at x. Start anchors the left edge in LTR and the right edge in RTL. End anchors the opposite edge. Middle anchors the midpoint. [Typeface and paragraph](https://nothing.graphics/docs/format/spec/text#typeface-and-paragraph)

### `direction` [#direction]

**Value** `ltr`, `rtl` · **If omitted** `ltr` · **Keys** Held

Paragraph base direction for bidirectional layout. [Typeface and paragraph](https://nothing.graphics/docs/format/spec/text#typeface-and-paragraph)

### `inline-size` [#inline-size]

**Value** local units · **If omitted** `natural line width` · **Keys** Scalar

Positive available width for soft wrapping. A track requires an authored finite width. [Typeface and paragraph](https://nothing.graphics/docs/format/spec/text#typeface-and-paragraph)

### `line-height` [#line-height]

**Value** local units · **If omitted** `1.2 times the sampled text font size` · **Keys** Scalar

Positive distance between successive baselines. [Typeface and paragraph](https://nothing.graphics/docs/format/spec/text#typeface-and-paragraph)

## Animation-only targets [#animation-only-targets]

[Property animation](https://nothing.graphics/docs/format/spec/animation#property-types-and-exceptions)

### `value` [#value]

**Value** `Literal Unicode character data` · **If omitted** `direct character data` · **Keys** Held · **Declared by** [Text copy](https://nothing.graphics/docs/format/reference/text-copy#value)

Replace the copy at the key's time. In an XML key value, write LF and tab as character references. A track requires an owner with no child spans. The base is the concatenated direct character data after XML processing.

## Children [#children]

| Elements                                                              | Cardinality  | Declared by | Role and source order                                                                                                                                                                                                |
| --------------------------------------------------------------------- | ------------ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`<span>`](https://nothing.graphics/docs/format/reference/span)       | Zero or more | `<text>`    | Editable copy ranges that can supply a local style. Document order interleaved with literal character data.                                                                                                          |
| [`<animate>`](https://nothing.graphics/docs/format/reference/animate) | Zero or more | Animation   | A track targets one keyable property on this owner. For equal first-key times, the later track in document order wins. [Evaluating animation tracks](https://nothing.graphics/docs/format/spec/animation#evaluation) |

## Specifications [#specifications]

* [Text content and ownership](https://nothing.graphics/docs/format/spec/text#content-and-ownership)
* [Typeface and paragraph](https://nothing.graphics/docs/format/spec/text#typeface-and-paragraph)
* [Authored font requests](https://nothing.graphics/docs/format/spec/fonts#authored-request)
* [Evaluating animation tracks](https://nothing.graphics/docs/format/spec/animation#evaluation)
