Hello Ventuzians!
THE FORUMS ARE CLOSED!

Please join our discord server HERE!! << click me :D

We are shutting our Ventuz Forum, but don't worry, it will all be archived for you to search in if you have a query. From now on, please add all your comments, questions or observations into our Discord Server

Thanks for the great time - see you on discord!!
Dee, Karol, Daniel and the whoooole Product and Support team!

Auto resize rectangle size with text length

Q and A about functionality and how to solve a special task for your application.

Moderator: Support

ahmedahmed1223
Posts: 45
Joined: 07 Jan 2017, 14:02

Auto resize rectangle size with text length

Post by ahmedahmed1223 » 08 Jun 2017, 20:46

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? :?:

ahmedahmed1223
Posts: 45
Joined: 07 Jan 2017, 14:02

Re: Auto resize rectangle size with text length

Post by ahmedahmed1223 » 09 Jun 2017, 10:04

Is there any ideas?
to explain my idea what i need to do something like this video
https://youtu.be/FgBzTSpg3A8?t=1m48s

User avatar
Eric_RD
Posts: 103
Joined: 04 Jun 2014, 14:01
Contact:

Re: Auto resize rectangle size with text length

Post by Eric_RD » 09 Jun 2017, 15:20

quite easy ;)
Arranger: Y-Chain
Sum up Textbox heights -> Y
Max Textbox width -> X
done
Attachments
bg_textbox.vzs
(11.57 KiB) Downloaded 215 times

ahmedahmed1223
Posts: 45
Joined: 07 Jan 2017, 14:02

Re: Auto resize rectangle size with text length

Post by ahmedahmed1223 » 09 Jun 2017, 21:33

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? :?:

ahmedahmed1223
Posts: 45
Joined: 07 Jan 2017, 14:02

Re: Auto resize rectangle size with text length

Post by ahmedahmed1223 » 12 Jun 2017, 12:40

Is there any other Ideas for this type of workflow?

Christian Krix Schmidt
Posts: 290
Joined: 18 Jan 2012, 11:36
Location: Dubai, United Arab Emirates
Contact:

Re: Auto resize rectangle size with text length

Post by Christian Krix Schmidt » 12 Jun 2017, 16:20

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.

SamTheSwede
Posts: 91
Joined: 18 Jan 2012, 11:31

Re: Auto resize rectangle size with text length

Post by SamTheSwede » 12 Jun 2017, 16:59

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
Attachments
BGSCALER.vzs
(12.72 KiB) Downloaded 181 times

ahmedahmed1223
Posts: 45
Joined: 07 Jan 2017, 14:02

Re: Auto resize rectangle size with text length

Post by ahmedahmed1223 » 12 Jun 2017, 17:41

thanks SamTheSwede and Christian
i will try your suggestions and solutions.

ahmedahmed1223
Posts: 45
Joined: 07 Jan 2017, 14:02

Re: Auto resize rectangle size with text length

Post by ahmedahmed1223 » 14 Jun 2017, 10:45

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?

User avatar
lerou
Posts: 345
Joined: 06 Sep 2013, 07:14
Location: Hamburg, Germany

Re: Auto resize rectangle size with text length

Post by lerou » 14 Jun 2017, 11:46

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
Attachments
shrink2fit_manual.vza
(16.15 KiB) Downloaded 233 times

Post Reply