Skip to main content

Apply Font Style

Intro

Apply Font Style can be used as a Style Behaviour to dynamically set styling features like Underline, Strikethrough, Subscript and Superscript used within a Text Shape in a procedural way. For example, set the last word to underline or set the word Cavalry to strikethrough each time it appears in a string.

UI

Underline - When checked, an underline style will be applied.

Strikethrough - When checked, a strikethrough style will be applied.

Supers Inferiors Mode - Select a Superscript or Subscript style:

  • None - No style.
  • Superscript - Set to Superscript.
  • Subscript - Set to Subscript.

Mode - Choose a mode for the selection:

  • Regex - Set a Regular Expression to determine which parts of the string will be selected. There are several presets available at the top of the Attribute Editor UI.
  • Specific Indices - Manually enter the indices to determine which lines/words/characters are selected.
  • All - Use this setting when using an Apply Typeface with a Behaviour. See Create > Demo Scenes > Text > Variable Font.

Index Mode - When the Mode is set to Specific Indices, select which level is affected:

  • Line - Fill each line within the string defined by Specific Indices.
  • Word - Fill each word within the string defined by Specific Indices.

Specific Indices - When the Mode is set to Specific Indices, set the indices to select. Values should be comma , separated for lists or colon : separated for ranges. e.g. 0,1:3,8 will select indices 0, 1, 2, 3 and 8. You can also enter first or last to procedurally select those indices. Note that a space character is included as an index.

Regex - Enter a Regular Expression. See Working with Regex for more information.

Capture Group Indices - Where a Regular Expression includes capture groups, determine which groups are returned. Values should be comma , separated for lists or colon : separated for ranges. See Working with Regex for more information.

Example
  1. Create a Text Shape.
  2. Enter the string First and last.
  3. Click the + to the right of the Style Behaviours attribute.
  4. Select Apply Font Style from the list.

An underline style will be added to the words First and last. Double click the Apply Font Style layer in the Scene Window and try replacing first,last in the Indices attribute with 1.

info

When adding styling to a Text Shape a new 'decorator' Shape is created.