Skip to main content
James Ronan
Known Participant
May 21, 2026

SourceRectAtTime doesn't work with variable fonts

  • May 21, 2026
  • 1 reply
  • 20 views

Trying to find a way to calculate the total width of an animated variable font text layer but the sourceRectAtTime properties of a text layer are not updating / taking into account the variable font adjustment. Also in Box Text, variable fonts go outside the box too.

Any help appreciated.
Thanks!

 

    1 reply

    Community Expert
    May 22, 2026

    Try adding this expression to a text layer above the text layer you want to animate:

    testLyr = thisComp.layer(index + 1)
    FontSize = testLyr.text.sourceText.style.fontSize;
    SRaTHeight = testLyr.sourceRectAtTime().height;
    SRaTWidth = testLyr.sourceRectAtTime().width;

    ratio = SRaTHeight/FontSize*100;
    "Font Size = " + FontSize + "\r" + "Height = " + SRaTHeight.toFixed(1) + "\r" + "Width = " + SRaTWidth.toFixed(1) + "\r" + ratio.toFixed(1) + "%"

    As long as you use text animators instead of scale, this will give you just about everything you need.

    You can also add modifiers to the value by incorporating scale into the expression.

    Hope this helps.