Page 1 of 2

Auto resize rectangle size with text length

Posted: 08 Jun 2017, 20:46
by ahmedahmed1223
Hi there.
how i can link background rectangle width and length values with foreground text with random lengths?
and if the text have the shrink to fit effect how i can do this setup? :?:

Re: Auto resize rectangle size with text length

Posted: 09 Jun 2017, 10:04
by ahmedahmed1223
Is there any ideas?
to explain my idea what i need to do something like this video
https://youtu.be/FgBzTSpg3A8?t=1m48s

Re: Auto resize rectangle size with text length

Posted: 09 Jun 2017, 15:20
by Eric_RD
quite easy ;)
Arranger: Y-Chain
Sum up Textbox heights -> Y
Max Textbox width -> X
done

Re: Auto resize rectangle size with text length

Posted: 09 Jun 2017, 21:33
by ahmedahmed1223
Thanks Eric_RD,
but what about shrink to fit effect usage case does this solution working in this workflow?
also if i need to scale the text using axis tool does this setup will work? :?:

Re: Auto resize rectangle size with text length

Posted: 12 Jun 2017, 12:40
by ahmedahmed1223
Is there any other Ideas for this type of workflow?

Re: Auto resize rectangle size with text length

Posted: 12 Jun 2017, 16:20
by Christian Krix Schmidt
If you have Shrink2Fit, then you only have to check for each line whether the width of your text is shorter or longer than the Shrink2Fit width. That's a small expression that does the trick and can be added to each text line. If the text is longer than the shrink2fit width you assign that width as the size for your rectangle. and if the text size is smaller than the shrink2fit width, you assign the text size as the size for the rectangle.

Re: Auto resize rectangle size with text length

Posted: 12 Jun 2017, 16:59
by SamTheSwede
This is how I usually do it, set a maxwidth in a "shrink to fit - node" then put all textwidths in a float array and figure out the highest number (max)

Good luck!

// Sam

Re: Auto resize rectangle size with text length

Posted: 12 Jun 2017, 17:41
by ahmedahmed1223
thanks SamTheSwede and Christian
i will try your suggestions and solutions.

Re: Auto resize rectangle size with text length

Posted: 14 Jun 2017, 10:45
by ahmedahmed1223
Thanks all but is there any other solutions like and tool to get the final size of bounding box the text or the axis nodes?
also i am using right to left text is there any suggestions for this setup?

Re: Auto resize rectangle size with text length

Posted: 14 Jun 2017, 11:46
by lerou
Hi,

creating a bounding box around text is very easy. You can use the bounding box generated by the Text node - as already proposed.

Now if you use shrink 2 fit, that effect obviously changes the bounding box. It also has a parameter for the bounding box type - but it does not output the new bounding box. I'd suggest asking Ventuz support to implement that feature - unless I'm missing something.

For now, you'd need to manually calculate the scale and mimic the effect's behaviour. Here's an example.

cheers,
rou