Adobe After Effects Expressions Forum
New line based on width text expression
New line based on width text expression
by Matt Evans on Oct 5, 2018 at 2:16:18 pm

Hi,
I'm hoping someone will be able to help me.

Is there an expression that could create a new line on a normal text layer based on a width I can set? I found the below expression by Dan Ebberts but it doesn't quite do what I need it to. This one does it based on characters whereas I will need to be based on width. Also, the other problem with this is that as it is based on characters words can be split apart when the new line is generated.
https://forums.creativecow.net/thread/227/34484#34487

Unfortunately I can't use a paragraph text box.
I'm currently using compCode to convert my templates into code which I can run and insert into other projects. However, after speaking to the creator of compCode, it seems that the boxTextPos function in AE scripting doesn't work properly (writing not reading)

This means that any templates with paragraph text layers that I try to compcode does not get inserted properly, because I am unable to write the boxTextPos therefore the position of paragraph text layers is off.

If anyone is able to advise it would be greatly appreciated

Thanks!
Matt


Re: New line based on width text expression
by Kalleheikki Kannisto on Oct 9, 2018 at 5:19:06 pm

I can only think of a rather complicated solution which involves measuring the individual letters widths one by one outside of the timeline. It is bound to be slow if done that way. Perhaps it would make more sense to measure the letters beforehand and create a table from which to calculate the actual length of the line based on characters and their widths with an expression. The kerning values would likely have to be approximated, I don't know how that is implemented in AE.

Kalleheikki Kannisto
Senior Graphic Designer


Re: New line based on width text expression
by Filip Vandueren on Oct 20, 2018 at 10:59:49 pm

Could you do a workaround where you let compcode fill in point-text, hide that layer
then add a paragraph-text that uses a simple pick-whip expression on sourceText to steal the contents, and perhaps even position ?







© CreativeCOW.net