Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

 
spoox
Topic Author
Posts: 5
Joined: Tue Sep 16, 2008 4:56 am

Accessing text properties

Wed Feb 03, 2016 3:01 pm

I am trying to figure out if it is possible from an expression to access 2 text properties:

1. If a bounding box is enabled, and if so, its size (width/height). I.e NOT .sourceRectAtTime() but the constraining box that wraps and limits the size of the text.

2. The paragraph alignment setting, i.e. left / center / right / justify last left / justify last right / justify all

So far it seems this is not accessible, as I do not get anywhere fiddling around with theTextLayer.Text.sourceText or theTextLayer("Text")("Source Text"). I see there is a .numProperties but there is no .property() function to access anything, so I am assuming that's the parent's property count.

Text layers apparently do not have any .source either, so there's no way of getting there that way...
 
Dan Ebberts
Posts: 319
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Accessing text properties

Wed Feb 03, 2016 5:27 pm

I'm afraid you're out of luck. You can poke around a little with source text expressions like this:

prop = text;
prop.numProperties;

or,

prop = text;
prop(3)(1).name

But I don't think you'll find anything helpful. Different story with scripting though...

Dan
 
spoox
Topic Author
Posts: 5
Joined: Tue Sep 16, 2008 4:56 am

Re: Accessing text properties

Thu Feb 04, 2016 3:11 am

Aha, but that was quite helpful actually at least in understanding how to iterate over the properties - it wasn't apparent how the relation to .numProperties and .(1..numProperties) worked.

For what I am doing I should be able to just write a script that will add the expression to the layer anyhow (if that is possible), that can inspect the values at design-time and just insert them into the expression. If not, I will just have to make these configuration options at the top of the expression..
 
spoox
Topic Author
Posts: 5
Joined: Tue Sep 16, 2008 4:56 am

Re: Accessing text properties

Mon Feb 08, 2016 5:14 am

As a side note: interestingly enough I did not actually need access to these properties, as I only needed to take into account the .left and .top aspects of the rect returned by sourceRectAtTime(). :)

Who is online

Users browsing this forum: No registered users and 5 guests