4 Replies Latest reply on May 13, 2014 11:44 PM by hemanthR

    how to fit text box to text automatically (like indesign)

    lsatony Level 1

      is there a way to make text boxes fit to the text that lives inside?

       

      i'm working on a comp & if i change the font size of text in a box, the text overflows the box & it makes alignment with other elements after the fact difficult (or impossible).

       

      i did create the text boxes initially by clicking & typing - in other words i didn't drag a text box and then type.  i did see on these forums that if you don't drag a text box when it's created that it should automatically fit around the text, but if i change the font size after the fact, the text overflows.

       

      anyone have any insight or workarounds for this?

       

      it would be great to see an option to "fit frame to text" like indesign.

       

      thanks!

        • 1. Re: how to fit text box to text automatically (like indesign)
          hemanthR Adobe Employee

          HI,

          If you click on stage and start typing ,the bounding box will fit text even after changing text or dragging it around.

          Bounding box will not fit once you resize text box using the resize handlers or apply any css transformation properties.

          One basic rule is as long your height and width property of the text box is set to auto ,bounding box will auto-fit

          1 person found this helpful
          • 2. Re: how to fit text box to text automatically (like indesign)
            lsatony Level 1

            hemanth kumar r wrote:

             

            One basic rule is as long your height and width property of the text box is set to auto ,bounding box will auto-fit

            I don't see an option to set a text box to auto width or height under position & size / properties.  Tried typing 'auto' for width or height & it just defaults to 0.

            • 3. Re: how to fit text box to text automatically (like indesign)
              lsatony Level 1

              aah, looks like it defaults to auto until you try to resize the text box.  once it's resized manually, i don't see a way to get auto back.

               

              the comp in question has a bunch of textboxes that i can't set to auto because they've been resized, and they also have keyframes for opacity & size animations.

               

              what would be the best way to set my existing text boxes to auto?  is this not possible?  if not, will i have to re-do all of my animations?  and if i do, will i then lose the auto property once the animations are in place again?

               

              thanks for your time & help!

              • 4. Re: how to fit text box to text automatically (like indesign)
                hemanthR Adobe Employee

                Though there is no straight forward way in UI to set width and height to 'auto',you will have to modify the <file name>_edge.js file.

                Open the  <file name>_edge.js file in a text editor

                Search for the text element you want to modify (You can search based on the element name)

                Below is example of the text element

                {

                                id: 'Text',

                                type: 'text',

                                rect: ['123px', '77px','122px','122px','auto', 'auto'],

                                text: "RUNNER",

                                font: ['Arial, Helvetica, sans-serif', [24, ""], "rgba(0,0,0,1)", "normal", "none", ""]

                }

                 

                Change the 3 and 4th parameters in 'rect' (122px,122px) to 'auto' like

                rect: ['123px', '77px','auto','auto','auto', 'auto']

                Now your elements width and height will be set auto.

                2 people found this helpful