Author Topic: Text resize with some bounds  (Read 5598 times)

0 Members and 1 Guest are viewing this topic.

kiler40

  • Sr. Member
  • ****
  • Posts: 329
Text resize with some bounds
« on: October 23, 2013, 02:57:27 AM »
Hello everybody.
Here is something maybe basic, but i still cant figure it out.
There is a text in a text box. The size of the text is linked with the text box height or width. but at some point the text will be higher that the box, and go out of the box, or it will be longer than the box and it will go on 2-3-4 rows...

I want to put bounds of the size of the text. all the time to stay in the box. and lets say the text will be no more that 4 character long so i have a start-up aspect ratio between the text box size and the amount of text.

Any  ideas ?
Thanks!
Andrei

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3858
  • Ideas Visio-lized into solutions
Re: Text resize with some bounds
« Reply #1 on: October 23, 2013, 01:45:15 PM »
For the most part, textheight is misleading.  Visio is not like PowerPoint where the text automatically resizes to stay within the bounds of the textbox.  Not sure why that functionality wasn't added to the newer releases as it tends to be a very singular request.  Normal behavior of Visio will limit the string length to the width of the textbox, add linefeeds as necessary to keep the text within the horizontal bounds.  That means, the text height will grow and grow and grow as you keep typing.  Raises the question, why is there a textheight cell???

Anyway, check out this link and the subsequent references in trail:  http://visguy.com/vgforum/index.php?topic=5151.msg20203;topicseen#msg20203

HTH
Wapperdude
Visio 2019 Pro

kiler40

  • Sr. Member
  • ****
  • Posts: 329
Re: Text resize with some bounds
« Reply #2 on: October 24, 2013, 12:07:00 AM »
No. This is not my point.
I have a box that says "A12" but it is not a constant text. However it will never be more than 3 symbols.
And i want to resize the text with resizing the box. If i lock the aspect ratio and link the text size to whenever height or width of the box it will resize withouth problem. But if i change the aspect ratio... the text (at some point) will go in 2 or 3 rows. And i don`t want this to happen.

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3858
  • Ideas Visio-lized into solutions
Re: Text resize with some bounds
« Reply #3 on: October 24, 2013, 01:08:39 AM »
Don't know if you've see this:  http://blogs.msdn.com/b/visio/archive/2006/08/11/694681.aspx

Talks about sizing text based upon shape size.

I know what aspect ratio is, but having problem understanding it's application to your needs.  Perhaps you can attach a Visio file to demonstrate problem.  After all, picture is worth 1000 words.   ::)

Wapperdude
Visio 2019 Pro

kiler40

  • Sr. Member
  • ****
  • Posts: 329
Re: Text resize with some bounds
« Reply #4 on: October 24, 2013, 02:26:21 AM »
Yes you are right ! :)

I have problems opening the link you have posted in my work PC...

The idea is to put the main shape in different cells wile keeping the text in the text box bounds.

If you choose to use the shape that the text is linked to the width of the box, with longer cells you`ll have text that goes out of the box from top and bottom.

If you choose the other shape that the text is linked to to the height you`ll have problems with the tight cells. The label will go in 2 rows.


wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3858
  • Ideas Visio-lized into solutions
Re: Text resize with some bounds
« Reply #5 on: October 24, 2013, 09:48:34 AM »
Ah!  The real goal seems to be to scale the text based upon changes to either height or width or both.  Both would allow just a single shape.  Hope that's correct.

The problem with char size based upon height is that wrapping is based upon the horizontal span of the text. 

Going in small steps you could
a.) use the max function to set an upper limit on text size.  For example, for your shape that bases the char size using shape width, you could set a max limit based upon some percent of the textbox height. 

Similarly for the shape using height as the control, set the max limit to some percent of textbox width.  That would avoid wrapping.

b.) use a formula that controls the char size based upon both height and width.  Perhaps something like
          1.  char size = 0.5*(width + height) or
          2.  char size = sqrt(width*height) or
          3.  some other relationship that you find works

c.) use combination of functions to limit size in development (b.)
          Something like if (char size > max height) then (set max char size), else (if char size > max width) then (set max char size),
          else (use your formula)  from (b).  Example:  if(CS>0.9*ht, CS=0.9*ht, if(CS > 0.8*width, CS=0.8*width,0.5*(width+height)))

The catenated if statements check for oversize violations and if none exist, uses the formula to calculate new size.  This then allows just the need for a single shape.

HTH
Wapperdude
« Last Edit: October 24, 2013, 02:14:19 PM by wapperdude »
Visio 2019 Pro

kiler40

  • Sr. Member
  • ****
  • Posts: 329
Re: Text resize with some bounds
« Reply #6 on: October 25, 2013, 12:56:43 AM »
It seems it is a tricky part in general :)
i`ll continue testing, and if i find a solution i`ll share.
And still if someone have figure it out, I`ll be happy to see it :)

Thanks !

Andrei

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3858
  • Ideas Visio-lized into solutions
Re: Text resize with some bounds
« Reply #7 on: October 25, 2013, 11:49:38 AM »
My apologies.  I forgot a basic issue with shapesheet calcs, especially regarding constraining text.  Basically, Visio doesn't handle this very well within the confines of the shapesheet.  The issue is constraining text based upon it's present value,  This is a looping formula that feeds back on itself and causes havoc.  What seems to be the solution is an approach developed by Visio Guy:  http://www.visguy.com/2008/02/11/lorem-ipsum-%E2%80%93-visio-ia-text-placeholder-shape/.  It will take some adaptation since its focus is truncating text and in this case, the goal is merely to constrain char size.

HTH
Wapperdude
Visio 2019 Pro