Skip to main content
brandonb96942845
Inspiring
February 23, 2024
Question

AE: Parenting text styles doesn't include character width?

  • February 23, 2024
  • 1 reply
  • 420 views

So I have this expression in one of my projects:

 

style = comp("Templates").layer("First Line Second Line").text.sourceText.style

 

And I noticed that it seems to capture everything except the character widths. Is that a bug or is there some additional step required to bring that property over?

This topic has been closed for replies.

1 reply

Legend
February 23, 2024

It's normal using style object you have access to the first character style of your string.

  • Font
  • Font Size
  • Faux Bold
  • Faux Italics
  • All Caps
  • Small Caps
  • Tracking
  • Leading
  • Auto Leading
  • Baseline Shift
  • Fill (enable/disable)
  • Fill Color
  • Stroke (enable/disable)
  • Stroke Color
  • Stroke Width

 

You can get the width of your string using sourceRectAtTime()

 

sourceRectAtTime(t = time, includeExtents = false)

Return type: JavaScript object with four attributes: [top, left, width, height]. Extents apply only to shape layers, increasing the size of the layer bounds as necessary, and paragraph text layers (After Effects 15.1 and later), where it returns the bounds of the paragraph box. Example:

 

 

myTextLayer.sourceRectAtTime().width

 

 

brandonb96942845
Inspiring
February 23, 2024

NOT what I was referring to. You're talking about the width of the text layer. I'm talking about the horizontal scale as set in the Character properties panel.

Dan Ebberts
Community Expert
Community Expert
February 23, 2024

Unfortunately, that's not one of the text attributes avialable to expressions, as listed here:

https://helpx.adobe.com/after-effects/using/expressions-text-properties.html