How to fit text box size to text?

I want to fit the artboard to selected art (two text boxes) - the text boxes are larger than the text inside them - how do I fit (shrink) them to wrap tightly around my text?

Illustrator version - CS5

Replay

Illustrator doesn't (as of 5.1) have a handy "fit frame to content" feature like InDesign. Just select the text frame and drag the handles inward until the frame is snug to the text.

There's a script for that. (this is probably the script Joonas' comment alludes to - works just fine in CS6).

(to then fit the art board after fitting the text box, use the art board tool and click on the text box)

Courtesy of Kelso Cartography who have loads of great scripts (their scripts to switch point and area text are also highly recommended), you can download the Fit Text To Content script here. It does exactly what it says on the tin - scales (up or down) a text area's text frame to fit the height of the lines of text.

Here's a 'before' and 'after' of this script, plus its cousin also from Kelso Cartography, Fit Text To Content Width, resizing a text frame to remove unused space (pic courtesy of vectips):

How to fit text box size to text?

Here are teh codez in case that link goes down. All credit to original author. Just save it as a .js file in your illustrator/presets/[some language code]/scripts folder then reboot Illustrator:

// FitToTextContent_Depth
// Nathaniel Vaughn KELSO
// Last modified: 2008.March.29
// Created: 2007.July.8
// at Hyattsville, MD
// Version 2
// (c) [email protected] (but remove the 2008 bit)
// DESC: Fits the text frame (rectangular path shapes only!) to fit the text content.
// DESC: Will either shrink or expand the depth of the text box as appropriate.
// TODO: Extend to work with text on a line (PATHTEXT)
// TODO: watch for 4 point paths that are not rectangular
// TODO: watch for 4 point paths that are rotated

var includeExtraLines = 0.5;

if(documents.length > 0) {
    doc = activeDocument;
    mySelection = activeDocument.selection;

    // If there are enough to process
    if (mySelection instanceof Array)
    {
        // For each of the selected items
        for(i=0; i<mySelection.length; i++) {
            // That are textFrames
            if (mySelection[i].typename == "TextFrame" && mySelection[i].kind == TextType.AREATEXT ) {
                obj = mySelection[i];

                // We only want to do this on rectangular text areas
                // TODO: Take care of rotation issues from MakePointType script
                if( obj.textPath.pathPoints.length == 4 ) {
                    objTop = obj.top;
                    objLeft = obj.left;

                    // Make the new point type object and locate it
                    // Make sure the new object is in the same Z stacking order as the original
                    copy1 = obj.duplicate(obj, ElementPlacement.PLACEBEFORE);
                    //copy1.move(obj, ElementPlacement.PLACEBEFORE);

                    // now make the text box much bigger, but not absurdly big
                    // TODO: This could be better approximated by itterating thru all the WORDS in the textFrame and
                    // comparing it to all the WORDS in each of the visible text LINES. Then apply the difference / total words to the scaling
                    if( copy1.height * 10 < 2000 ) {
                        copy1.textPath.height = copy1.height * 10;
                    } else {
                        copy1.textPath.height = 2000;
                    }

                    howManyLines = copy1.lines.length;

                    outlineObject = copy1.duplicate();
                    outlineObject = outlineObject.createOutline();

                    targetHeight = outlineObject.height + includeExtraLines * (outlineObject.height / howManyLines );

                    // Now assign y-axis depth of the point text to the area text box
                    rect = obj.parent.pathItems.rectangle(copy1.textPath.top, copy1.textPath.left, obj.width, targetHeight);
                    copy2 = obj.parent.textFrames.areaText(rect);
                    copy2.selected = true;
                    rect.selected = true;

                    // Always delete these intermediate objects
                    outlineObject.remove();
                    copy1.remove();

                    // Now take care of the end and original objects
                    obj.textRange.duplicate(copy2);
                    obj.remove();
                }
            }
        }
    }
}

This is now a built-in feature as of 2014 in Adobe Illustrator CC. You'll find it under Type > Area Type Options > Auto Size.

Category: adobe illustrator Time: 2011-11-07 Views: 0

Related post

  • Keynote control text box size 2015-03-07

    How do I control the text box size in Keynote? My main problem is that I can't even select the box, though I can select text within the box. When I click on the paintbrush on the upper right of the keynote page, and then select Arrange, the dimension

  • Disable text box with preedit text when using an input source and searching in Finder 2015-11-13

    This text box appears when I'm using a different input source than English, and quick search in any file list. So when I press A it should point to the file start with a, but instead it display a text box with preedit text. The box is really annoying

  • Cognito Forms: How to match contents of a text box to another text box 2016-02-01

    I would like the email text box content to match the email confirmation text box content (email confirmation text field must be written by the user) and give an error massage when it does not match. How can I do that on the form?

  • How do I change a text box to a text area? (ArcGIS API for JavaScript) 2011-05-25

    I recently posted this question on the Esri forums and thought I'd give stack exchange a try too. I'd like to take this sample: http://help.arcgis.com/en/webapi/javascript/arcgis/demos/ed/ed_multipleAttrInspector.html and change the text boxes to tex

  • How to set different font size for text of label nodes in gexf format 2016-01-31

    I'm having a problem with label size. I need my graph to show text of node labels with different font sizes. This is not work: <node id="155" label="text text" font-size="10000px"> viz:color r="0" g="255&

  • Fit second text box to another text boxes path 2016-07-27

    I'm working with two languages (english and arabic) and I want to keep the text boxes separate so that the styles do not clash. I have a unique text box shape for the english as it covers the whole product. I am trying to find a way to make a second

  • Auto Fill Text Boxes With Main Text Box Content 2016-01-24

    I'm trying to auto-fill text boxes 1 to 3 with the main text box content so that whatever is typed into the text box "Title" will also appear in the text boxes Input1, Input2 and Input3. Here is what I have, but I get an error. <html> <

  • How can I enlarge the size of text on the printout of a PDF? 2014-02-18

    I have a few PDF files, for instance this one, which are in the Tamil language, and I want to print them out. Unfortunately, when I just print them out normally, the text is too small for my grandfather to read, so I want to enlarge the text somehow.

  • How to change temporarily font size in text console in openSUSE? 2011-04-27

    I found several answers already but all of them are focused on changing size for good, i.e. at Lilo/Grub level. I don't want this though. So, key issues: changing size on-fly, I would like to increase size, and 5 minutes later, decrease it back it is

  • Strike through text without affecting text box size 2013-11-03

    I want to strike through text with a simple line. Unfortunately, in the solution(s) I found, the text always has a larger distance to the next line (see example). How can I strike through text without increasing the distance to the next line? \docume

  • Resize text box size when hiding field labels on quote templates/PDFs 2015-07-22

    I have a section on a quote template for terms and conditions. The first part of the section uses a block of text which is the same for all quotes. The next part of the section is a field which shows different text based on the specific quote. I want

  • tikZ - mindmap - How to increase the font size of text in a node concept 2015-12-11

    I have just drawn a mind map with your help in a previous question. Once I print the document, the font is too small and does not read very well. Before to reduce the length of text I am looking for a way to increase the font size. I looked for on th

  • How to increase the font size in text-only mode with high DPI 2012-08-08

    I am using Ubuntu 12.04. Recently, the font size for all of my TTYs became much larger. How can I change the font size back to the default? --------------Solutions------------- To adjust the font/font-size used for the TTY, run sudo dpkg-reconfigure

  • How to reduce the box size around a label 2015-12-07

    I am trying to draw the following figure: Please observe that the label "h" has a very large "white" box around it. I would like to reduce the size of this box so that the figure looks better. How do I do this? Here is the TiKz code: \

  • Creating flexible text boxes in Illustrator 2013-01-29

    I'm going to be making images that include hundreds of lines of text of varying lengths, each of which will have the same "background", with the exception of the length of the background, which will need to be relative to the length of the text.

  • How to resize a draw.io text box automatically to fit the text? 2015-02-04

    I am new to draw.io, and find it tedious that after inserting a text box and typing text in it, I have to manually resize the text box such that the entire text fits in. Is there a shortcut to automatically resize the text box, such that it fits the

  • How to "fit frame to content" with overset text, to a single line in InDesign 2015-05-08

    I would like for when I choose "fit frame to content" on a text box with overset text, the frame width is adjusted to fit the remaining text, rather than the height. The image should visually explain. --------------Solutions------------- Looks l

  • How can a macro be created to insert a text box pre-populated with text in Word 2010? 2015-01-05

    I am attempting to create a Macro to insert a textbox populated with predetermined text when a shortcut key is selected. I am able to record a Macro to generate the text but I am unable to get it to populate the text box with the text inside. For exa

  • How do I link text boxes in iBooks Author? 2012-01-23

    I've been trying out iBooks author, and one thing i want to be able to do is to allow text overflow from one custom text box to another. In pages this is done either by clicking the blue little symbol in the lower-right part of a text box with too mu

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.699 (s). 13 q(s)