# Text Shape

### Intro

{% hint style="success" %}
A **Text Shape** can also be created in the [Viewport](https://scenegroup.gitbook.io/cavalry/user-interface/menus/window-menu/viewport) using the [Text](https://scenegroup.gitbook.io/cavalry/user-interface/menus/tool-menu/text-tool) tool. With the Text tool selected, click and drag to draw a **Text Box**. If you `alt + click` on the Text tool or, with the Text tool selected, click once in the Viewport, the **Text Shape** will be created with **Auto Width** and **Auto Height** checked. This results in the text box fitting the text rather than the text fitting within the **Text Box**.
{% endhint %}

{% embed url="<https://youtu.be/aEcAkqYi8T8>" %}

### UI

[Common Attributes](https://scenegroup.gitbook.io/cavalry/nodes/shapes/common-attributes) +&#x20;

**String** - enter text, numbers or symbols here.

**`+`** - add a [String Generator](https://scenegroup.gitbook.io/cavalry/nodes/utilities/string-generator).

`T` - open the [Glyph Browser](https://scenegroup.gitbook.io/cavalry/user-interface/menus/window-menu/glyph-browser).

**Font** - select the Font and Weight.

{% hint style="info" %}
If you select a **Variable Font** a small icon will appear to the right. Click this icon to load a pop up window to access the font's axes.
{% endhint %}

**Typeface** - see [Typeface](https://scenegroup.gitbook.io/cavalry/nodes/utilities/typeface).

**Font Size** - set the size of your font.

**Alignment** - align text horizontally to the Left, Centre or Right.

**Vertical Alignment** - align text vertically to the Top, Centr&#x65;**,** Bottom or Baseline.

**Character Spacing** - set the distance between characters.

**Word Spacing** - set the distance between words.

**Line Spacing** - set the distance between lines.

**Text Box Size** - set the size of the area the text wraps within.

* **Auto Width** - when checked, the Text Box is sized to the width of the text.
* **Auto Height** - when checked, the Text Box is sized to the height of the text.

**Force Monospacing** - click the checkbox to remove any kerning from non monospace fonts (useful when animating text strings but need to maintain each character's position). Use the **Monospace Multiplier** to increase or decrease the space between monospaced characters.

**String Manipulators** - add a [String Manipulator](https://scenegroup.gitbook.io/cavalry/nodes/utilities/string-manipulator).

**Style Behaviours** - add a Style Behaviour. Style Behaviours allow for the procedural manipulation of text strings.

**Formatting Inputs** - inject a String/ Text into the Text Shape. This allows you to set up Text containing different styles, colours or sizes. Any connected Text or String can then be referenced by its index within curly brackets. For example, a Text Shape containing the Text string `Cavalry {0}` will inject the text from another Text Shape connected to **Formatting Inputs** index **0**.

{% hint style="info" %}
**Formatting Inputs** example:

1. Create a **Text Shape** (Text Shape 1).
2. Using the `+` icon on the **Formatting Inputs** attribute row, add a second **Text Shape** (Text Shape 2).
3. Set the **Font Weight** for **Text Shape 2** to **Bold**.
4. On the **Fill** tab, set **Text Shape 2**'s **Color** to blue.
5. Change the **Text** input for **Text Shape 2** to `rules`.
6. On **Text Shape 1**, insert a space character between `Cavalry` and `{0}`

Text Shape 1 now displays 'Cavalry **rules**' (with rules in blue).
{% endhint %}

{% hint style="info" %}
See [Sub-Mesh](https://scenegroup.gitbook.io/cavalry/nodes/behaviours/sub-mesh) for animating **Text.**
{% endhint %}
