Skip navigation
Currently Being Moderated

Fit frame to content... horizontally?

Mar 20, 2012 10:33 AM

Tags: #content #frame #text #indesign #to #fit

I would like to fit text frames to their content (numbers from 1 to 31, 1 being much "horizontally" shorter than 25, for example).

Pressing alt + cmd + C only fits the height of the box, not its width. Is this intended to be that way? Can I change some setting so that the text frame fits exactly to the content, both vertically and horizontally?

 
Replies
  • Currently Being Moderated
    Mar 20, 2012 2:47 PM   in reply to csmarisol2

    Try double-clicking the lower right control handle on the selected frame.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 20, 2012 3:00 PM   in reply to csmarisol2

    Show non-printing characters and be sure there isn't something else in the frame you don't see.

     
    |
    Mark as:
  • winterm
    176 posts
    Sep 16, 2010
    Currently Being Moderated
    Mar 20, 2012 3:05 PM   in reply to csmarisol2

    If you want it "automagically", you need a script...

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2012 6:36 AM   in reply to winterm

    winterm wrote:

     

    If you want it "automagically", you need a script...

    Not sure what you mean by that . Bothe the shortcut and the double-click onthe handle should be sizing the frame to fit without any script.

     

    csmarisol12, have you tried trashing your prefs? see Replace Your Preferences

     
    |
    Mark as:
  • winterm
    176 posts
    Sep 16, 2010
    Currently Being Moderated
    Mar 21, 2012 7:20 AM   in reply to Peter Spier

    Peter,

    yes - for ONE frame.

    if you want to deal with ALL document frames at once - you need script.

    OP mentioned he has 90-100 such frames in document. OP knows those "tricks" with KS or double clicks, and he still asks for help here. I insist - he needs a script.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2012 7:26 AM   in reply to winterm

    Right. I just wasn't sure if you meant script to do them all at once, or script to make it work at all, since the original complaint is that the shortcut isn't working as intended.

     
    |
    Mark as:
  • winterm
    176 posts
    Sep 16, 2010
    Currently Being Moderated
    Mar 21, 2012 7:36 AM   in reply to csmarisol2

    Well, I'm not sure if I'm not hurting the rules of the forum (there is special forum for scripting)...

    However, here is the JS code I use for identical purposes, maybe you'll find it helpful:

     

     

    /*
    This script Fits Text Frames to Content
    */
    myDialog = app.dialogs.add ({name:"Script going to start",canCancel:true});
     
    with (myDialog)
         with (dialogColumns.add())
    //     with (dialogRows.add())
         {
                       staticTexts.add ({staticLabel:"This script will Fit Text Frames to Content."});
                       staticTexts.add ({staticLabel:"Proceed?"});
     if (!myDialog.show())
    {
         myDialog.destroy();
         exit(0);
    }
    }
    var myTFs = app.activeDocument.textFrames.everyItem().getElements();
        for (var i=0; i<myTFs.length; i++) {
                myTFs[i].fit( FitOptions.FRAME_TO_CONTENT );
                var gb = myTFs[i].geometricBounds;
                while (myTFs[i].overflows) {
                            gb[3]++;
                            gb[2]++;
                            myTFs[i].geometricBounds = gb;
                        }
                }
    var _d = app.documents[0];
    var _allStories = _d.stories;
    for(var n=_allStories.length-1;n>=0;n--){
    var _storyAllTextFrames = _allStories[n].textContainers;
    for(var m=_storyAllTextFrames.length-1;m>=0;m--){
    _storyAllTextFrames[m].select();
                //Fit Frame to Content:
                try{
                app.scriptMenuActions.itemByID(11291).invoke();
                    }catch(e){};
                //Deselect All
               try{
               app.scriptMenuActions.itemByID(278).invoke();
                    }catch(e){};
                };
            };
     
        alert("Fit Text Frames to Content\nDone!");
    
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 21, 2012 7:42 AM   in reply to winterm

    You're not breaking any rules at all. Thanks for posting the script.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 26, 2012 11:23 AM   in reply to Peter Spier

    Ok, so does anyone have an answer to the original question? which is fitting a frame horizontally? I'd love to know how to do this. It's pretty annoying to have text jump down to the next line when fitting the text frame instead of the frame extending horizontally to fit the text.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 26, 2012 1:51 PM   in reply to Andymc7

    If you are saying that you want to resize the width to make two lines of text into a single line, that's not the original question, and I don't believe that can be done other than by script.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2012 12:39 PM   in reply to Peter Spier

    No Peter, that's not what I'm asking. I'm simply asking if it's possible to say, increase the point size of the text, then fit the frame and not have the text skip to the next line, but fit it horizontally.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2012 12:58 PM   in reply to Andymc7

    If you are using CS6 there are new Auto-Size options in the Text Frame Options dialog that that might help you. I've never used them, so I don't know all of the intricacies and pitfalls.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2012 5:12 AM   in reply to Andymc7

    I think I know what the OP means. This can be done with GREP styles. check out this article to see if this helps:

     

    http://colecandoo.wordpress.com/2012/02/18/square-pegs-now-fit-into-ro und-holes/

     
    |
    Mark as:
  • winterm
    176 posts
    Sep 16, 2010
    Currently Being Moderated
    Sep 30, 2012 7:27 AM   in reply to cdflash

    @cdflash:

    Andymc7 isn't the OP (original question here is more or less answered, I believe) and Andy's problem is a bit different. However, thank you for an interesting link, never seen it... Have one project where I'll try that technique definitely

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 30, 2012 5:50 PM   in reply to winterm

    that's correct, i'd meant to answer Andymc7's question with the link there. oops

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points