Apply Typeface
Intro
Apply Typeface can be used as a Style Behaviour to dynamically set the typeface used within a Text Shape in a procedural way.
Regex
Cavalry supports ECMAScript regex.
UI
Font - Select a typeface and weight.
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.
Regex
Cavalry supports ECMAScript regex.
Index Mode:
- Line - Set a typeface for each line within the string defined by Specific Indices.
- Word - Set a typeface for each word within the string defined by Specific Indices.
- Character - Set a typeface for each character within the string defined by Specific Indices.
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.
Example
- Create a Text Shape.
- Enter the string
Here's to the crazy ones
. - Click the
+
to the right of the Style Behaviours attribute. - Select Apply Typeface from the list.
- Double click the Apply Typeface layer in the Scene Window to load its UI into the Attribute Editor.
- Set a Font of your choice.
- Enter the string
crazy
in the Regex attribute.
The word crazy
within the Text Shape will be set to the font selected on step 6.