genie

Genie Developer Hub

Welcome to the genie developer hub. You'll find comprehensive guides and documentation to help you start working with genie as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    API Reference

Text Styling

Fonts, custom textualization, and more!

Customising your text

Below is an example showing 3 phrases in the font - Avenir Black 74px ( just used for simplicity ) .

  • The first case has a maxWidth of 200px + lineSpacing
  • The second case has maxWidth of 300px + strokes
  • And the 3rd case has no maxWidth specified but shows letterSpacing
{
  "duration": 1000,
  "objects": [
    {
      "comment": "eg1- showing maxwidth, linespacing",
      "opacity": 1,
      "scale": 1,
      "fill": "#FFE7DC",
      "text": "Welcome \n to the",
      "align": "left",
      "fontFamily": {
        "url": "https://res.cloudinary.com/dsvdhggfk/raw/upload/v1534229930/Avenir-Black_vsvlou.ttf",
        "name": "Avenir Black"
      },
      "lineSpacing": 1.2,
      "fontSize": "74",
      "position": {
        "y": 10,
        "x": 10
      },
      "type": "text",
      "maxWidth": 200
    },
    {
      "comment": "eg2 - showing maxwidth, stroke",
      "opacity": 1,
      "scale": 1,
      "fill": "#FFF2EC",
      "text": "Kubric Studio",
      "stroke": {
        "color": "#685489",
        "width": 12,
        "join": "round"
      },
      "align": "left",
      "fontFamily": {
        "url": "https://res.cloudinary.com/dsvdhggfk/raw/upload/v1534229930/Avenir-Black_vsvlou.ttf",
        "name": "Avenir Black"
      },
      "fontSize": "80",
      "position": {
        "y": 50,
        "x": 250
      },
      "type": "text",
      "maxWidth": 300
    },
    {
      "comment": "eg3 - showing letterSpacing",
      "opacity": 1,
      "scale": 1,
      "fill": "#AAF3FF",
      "text": "LETS GET CREATIVE!",
      "letterSpacing": 10,
      "align": "left",
      "fontFamily": {
        "url": "https://res.cloudinary.com/dsvdhggfk/raw/upload/v1534229930/Avenir-Black_vsvlou.ttf",
        "name": "Avenir Black"
      },
      "fontSize": 40,
      "position": {
        "y": 200,
        "x": 10
      },
      "type": "text"
    }
  ],
  "size": {
    "w": 600,
    "h": 300
  }
}

Field

Description

align

Used to horizontally align the text at the given x position.possible values - "start", "end", "left" (default), "center", "right".
see align properties below for more details

position

To set the position where the text should render. JSON Object with properties - x, y, baseline (optional). ( Default {x : 0, y : 0, baseline: false} )
see position properties below for more details.

maxwidth

Texts can be provided with a maxWidth property that denotes the maximum width that can be occupied by that text on the screen. If the font size provided is such that it will exceed the maxWidth provided, the text fontSize and letterSpacing(if any) will be scaled down to fit the text into this width.
maxwidth explaination and example below.

lineSpacing

Control spacing between lines for multi-line texts. possible values: any number*

  • texts having newline character( \n ) will be rendered in multiple lines. The spacing between lines = fontSize x lineSpacing.*

letterSpacing

letterSpacing defines the width of the gap between successive letters in a text.

Text Properties

  • Align property
    The following image depicts the effect of the align property. Imagine the red line to be perpendicular to the top edge of the canvas, at a distance of x(provided in the position property) from its left edge.

📘

If a multi line text is provided with align, each individual line aligned separately and placed as per the above rules

  • Position property
    If only x and y is provided, it means that top-left corner of the bounding box enclosing the text will be at the position defined by x and y as shown below.

If baseline property is true, it will position the text in such a way that the left edge of the bounding box will be aligned along a line passing through x, parallel to the left edge of the video and the alphabetic baseline of the first line of text will be aligned with a line passing through y, parallel to the top edge of the video. This is shown below -

  • Maxwidth property
    The rules for scaling down are as follows
    - If there is no letterSpacing provided, then the fontSize is scaled down so that the width of the final rendered text fits within the maxWidth
    - If letterSpacing is provided, both the fontSize and the letterSpacing scales down in the ratio 7:3

Updated 10 months ago


What's Next

Curves

Text Styling


Fonts, custom textualization, and more!

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.