Text

A 3D-transformable, 2D rectangular area with a well-defined size that contains formatted text.

The content of a text layer is defined by means of a simple XML-based markup language, called CharacterWorks Markup Language, or CWML.

Text layers support scrolling in horizontal and vertical directions, where the size of the layer defines the boundaries (see also Layer Timing).

CW provides several tools to create text layers that come with useful default settings and preset CWML codes:
See the CWML reference for additional customization options for some of the specialized text layers created by the tools listed above.

Text layers can display dynamic and/or shared data from data sources. The CWML data tag, along with the field attribute, is used to refer to data items from a connected data source within text content. For example, the Twitter Data Source provides a list of tweets and users which can be referenced by specifying <data field=”tweet”/> and <data field=”user”/>. In the final output, these tags are replaced by the actual data items provided by the data source.

Additional user interface facilities are provided for quick generation of text layers with data source links. For example, drag a cell from a Twitter Data Source to the Graphics Viewer to quickly create a text layer that contains CWML referring to that cell of the Twitter source.

The size of a text layer is controlled by the size attribute, which is animatable like most layer attributes. The size of a text layer can be modified visually by dragging the layer corners or mid-points in the Graphics Viewer, or the desired size can be directly entered in the text box. The layer area can be locked to prevent it from being enlarged automatically when content is entered.

Text layers support automatic switching between alternate fonts in case the content does not fit within the specified maximum size. Use the Add Font button to add an alternate font in the Fonts box. Font alternatives can have completely different values for family, style and size settings. CW will try each font in the Fonts box, progressing from top to bottom, until it finds a font with which the content fits in the text area. If such a font cannot be found, then the bottommost font in the list is used. It is recommended to disable word wrap when using automatic font switching.

A text layer is also a composition, i.e. it can have child layers. The difference from a regular composition is that the placement (transformation) of the child layer instances is determined by the relevant tags (such as child) in the CWML content for the text layer.

To insert a layer as a child into a text layer, select the text layer, then, hold SHIFT and drag the layer from Graphics Viewer to the desired location in the text layer content editor. The dragged layer will be added to the children of the text layer (unless it already is) and a child tag referring to the child layer will be inserted at the drop location in the text content. The tag can be copied to other locations in the content to clone the child elsewhere in text.

The child tag can also choose which child layer to display based on input from a data source. The data item from the data source is used to look up the child layer by name. Just like the data tag, use the field attribute to specify the data field name. For example, this method can be used to display a flag image (child layer) based on the country name input from a data source. For details, see the sample project links below.

Text layers can also obtain their content from an external plain text file. In this mode of operation, by default, a text layer will automatically update itself whenever the file it is linked to is modified. However, this behaviour may be customized by defining a behaviour with the UpdateText action.

Once a scrolling text layer goes through all of its text content, it will emit the TextFinished event. This event can be used for a number of purposes, such as, updating from the input file with the UpdateText action (see above), or updating input data sources via behaviours or simply restarting scrolling along with some animations.

Area materials can be used to render backgrounds for the text. The layer size (and thus, the size of the layer background area) is controlled by the Size Control attribute. In Auto mode, layer background area covers the actual text area plus the margins, limited by the Min. and Max. Size settings. In Manual mode, background area becomes equal to the entire Max. Size.

Text layers contain the following base attributes and settings related to the rendering of animated text:
In addition to the above, text layers support the following standard layer features:

See also: CompositionMotionImage, Materials, Effects, Data SourcesBehaviours.