如何使文本框大小适合文本?

平面设计 adobe-illustrator 文本 cs5 调整大小 画板
2022-01-10 13:29:16

我想使画板适合选定的艺术(两个文本框) - 文本框比其中的文本大 - 我如何适应(缩小)它们以紧紧包裹我的文本?

插画版 - CS5

3个回答

从 2014 年开始,这现在是 Adob​​e Illustrator CC 中的内置功能。您可以在“类型”>“区域类型选项”>“自动大小”下找到它。

Illustrator(从 5.1 开始)没有像 InDesign 这样方便的“使框架适合内容”功能。只需选择文本框架并向内拖动手柄,直到框架紧贴文本。

有一个脚本。(这可能是 Joonas 的评论所暗示的脚本 - 在 CS6 中工作得很好)。

(要在适合文本框之后再适合艺术板,使用艺术板工具并单击文本框)

感谢拥有大量出色脚本的Kelso Cartography(他们的脚本切换点和区域文本也非常推荐),您可以在此处下载适合文本到内容的脚本它完全按照它在锡上所说的 - 缩放(向上或向下)文本区域的文本框架以适应文本行的高度。

这是这个脚本的“之前”和“之后”,加上它的表亲也来自 Kelso Cartography,将文本调整到内容宽度,调整文本框的大小以删除未使用的空间(图片由vectips提供):

在此处输入图像描述

这是链接断开的情况下的codez。所有功劳归于原作者。只需将其保存为文件夹中的 .js 文件,illustrator/presets/[some language code]/scripts然后重新启动 Illustrator:

// FitToTextContent_Depth
// Nathaniel Vaughn KELSO
// Last modified: 2008.March.29
// Created: 2007.July.8 
// at Hyattsville, MD
// Version 2
// (c) nvkelso2008@gmail.com (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();   
                }
            }
        }
    }
}