• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Auto-scale a text line in a multi-lines text layer

New Here ,
May 21, 2021 May 21, 2021

Copy link to clipboard

Copied

Hello,

I have an issue and I wonder if you could help me.
I'll try to explain, my English is not perfect sorry.

I have a text layer with 5 lines. By line I mean I hit enter 4 times :

Bla bla bla bla bla
bla bla bla
bla bla bla bla bla bla bla
bla bla bla
bla.

I need to scale each line to have a nice alignement.
I succeed to do that with five text layer and the expression SourceRecAtTime() combined to the scale of the layer 2-3-4 and 5. The number 1 being my master.

But now I need to have only one text layer (easier to use for my journalists)... but still 5 lines and the nice alignement.
So I precomposed my text five times and extract each line. From now I can scale each line (and auto move on Y axis) to have a nice result.

But if I want to do it automatically, I need to know which height is doing each line.
And now is my problem.
How to do a SourceRecAtTime() on just one line ?
I tried and tried to duplicate my text and to subtract the line I need to measure it.
Unsuccessfully...

If anyone has an idea.
Thank you.

TOPICS
Expressions , How to

Views

740

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 22, 2021 May 22, 2021

Copy link to clipboard

Copied

That's what sampleImage() potentially could do. Other than that of course nothing stops you from having auxiliary constructs inside the pre-comps like solids or shape layer rectangles that match the text and who's values can be read directly from their properties.

 

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 23, 2021 May 23, 2021

Copy link to clipboard

Copied

Thank you for your response Mylenium.

I don't know sampleImage() but I will try it.

 

And yes I would like to have the width (sorry not the height like I wrote) of each line in one same text layer.

I'm sure it's possible.

 

I'll come back to you if sampleImage() works for me.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 27, 2021 May 27, 2021

Copy link to clipboard

Copied

LATEST

Hello Mylenium,

 

Finally I did what someone else told me and it worked well :

 

I think I’d keep your five separate text layers (one for each line), but link their sourceTexts to a master text layer that the journalists would use to enter text.

I’d parent each of the separate lines to the master and hide the master (or set opacity to zero), then do a split expression to separate the lines:

txt = parent.text.sourceText ;
lines = txt.split('\r') ;
lines[0] // change 0 to 1, 2, 3, or 4 depending which line of text you want

 

But thank you for your response !

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines