API & Integration -> RenderScript

Text properties in RenderScript

These properties extend the base element properties.

Dimensions

Set the width and height of the text element. When set to null, dimensions will automatically adjust to fit the text content.

Example

"width": 300, "height": 100,

Defaults

"width": null, "height": null,

Fill color

The default fill color is #000000 (black).

Example

"fill_color": "#ffffff",

Default

"fill_color": "#000000",

Text alignment

Control horizontal and vertical text alignment within the element. X alignment: 0% (left) to 100% (right). Y alignment: 0% (top) to 100% (bottom).

Example

"x_alignment": "50%", "y_alignment": "50%",

Defaults

"x_alignment": "0%", "y_alignment": "0%",

Text

The text displayed in the element.

Example

"text": "Hello, world!",

Default

"text": "",

Font styling

Control the font appearance including family, weight, and style. Font family can reference custom fonts defined at the template level.

Example

"font_family": "Montserrat", "font_weight": 700, "font_style": "italic",

Defaults

"font_family": "Aileron", "font_weight": 400, "font_style": "normal",

Font sizing

Control font size behavior. Set a fixed size or use null for automatic sizing with minimum and maximum constraints.

Example

"font_size": null, "font_size_minimum": "2 vmin", "font_size_maximum": "50 vmin",

Defaults

"font_size": null, "font_size_minimum": "1 vmin", "font_size_maximum": "100 vmin",

Text formatting

Control text spacing, wrapping, clipping, and transformation. line_height is a percentage of the font size. letter_spacing is in tenths of a percent of the font size: 1000% is one em, so the CSS value 0.05em is 50%.

Example

"letter_spacing": "50%", "line_height": "150%", "text_wrap": false, "text_clip": true, "text_transform": "uppercase",

Defaults

"letter_spacing": "0%", "line_height": "115%", "text_wrap": true, "text_clip": false, "text_transform": "none",

Text direction

The base writing direction of the text: 'ltr' (the default) or 'rtl' for right-to-left languages.

Example

"text_direction": "rtl",

Default

"text_direction": "ltr",

Background styling

Add a background color behind the text with customizable padding, border radius, and alignment threshold for multi-line text.

Example

"background_color": "#ffffff", "background_x_padding": "50%", "background_y_padding": "50%", "background_border_radius": "10%", "background_align_threshold": "30%",

Defaults

"background_color": null, "background_x_padding": "25%", "background_y_padding": "25%", "background_border_radius": "0%", "background_align_threshold": "20%",

Transcript settings

Subtitles. transcript_source names the audio or video element to caption (transcribed at render time), or holds an SRT or WebVTT string, or an array of your own word timings with 'time', 'duration' and 'value' per word (see Provide your own subtitles). transcript_effect is how the spoken word is marked: 'color', 'karaoke', 'highlight', 'fade', 'bounce', 'slide' or 'enlarge'. transcript_split is the unit the effect applies to: 'none', 'line', 'word' or 'letter'. transcript_placement is 'static', 'animate' or 'align'. transcript_maximum_length is the number of characters per caption. transcript_color is the color of the word being spoken; the text's fill_color is the color of the rest.

Example

"transcript_source": "video-1", "transcript_effect": "karaoke", "transcript_split": "line", "transcript_placement": "animate", "transcript_maximum_length": 100, "transcript_color": "#3498db",

Defaults

"transcript_source": null, "transcript_effect": "color", "transcript_split": "word", "transcript_placement": "static", "transcript_maximum_length": null, "transcript_color": "#e74c3c",