adobe-illustrator - 在 illustrator 中选择字体大小介于两种大小之间的所有对象?

标签 adobe-illustrator

我需要选择大小介于两个值之间的所有文本对象,例如 12 和 14pt(包括 12.1、12.2 等)。这有可能吗?

最佳答案

这似乎是一个脚本的候选。试试这个:

function selectTextWhosePointSizeIs ( minPointSize, maxPointSize )
{
    var doc, tfs, i = 0, n = 0, selectionArray = [];

    if ( !app.documents.length ) { return; }

    doc = app.activeDocument;
    tfs = doc.textFrames;
    n = tfs.length;

    if ( !n ){ return; }

    if ( isNaN ( minPointSize ) )
    {
        alert(minPointSize + " is not a valid number" );
        return;
    }
    else if ( isNaN ( maxPointSize ) )
    {
        alert(maxPointSize + " is not a valid number" );
        return;
    }
    else if ( minPointSize > maxPointSize )
    {
        alert(minPointSize + " can't be greater than "+ maxPointSize);
        return;
    }

    for ( i = 0 ; i < n ; i++ )
    {
        if ( tfs[i].textRange.size >= minPointSize && tfs[i].textRange.size <= maxPointSize )
        {
            selectionArray [ selectionArray.length ] = tfs[i];
        }
    }

    if ( selectionArray.length )
    {
        app.selection = selectionArray;
    }
    else
    {
        alert("Nothing found in this range.");
    }
}

selectTextWhosePointSizeIs ( 12, 14 );

希望对你有帮助

洛奇

关于adobe-illustrator - 在 illustrator 中选择字体大小介于两种大小之间的所有对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11152749/

相关文章:

image - 如何在 Adob​​e Illustrator 9 中找到链接图像的路径?

javascript - 使用extendscript在illustrator中缩放对象

javascript - Extendscript Toolkit 2 无法针对 Illustrator CS3

xml - 任何想法为什么图案化的 SVG 文件在浏览器中显示为空白?

wpf - 如何将 Illustrator 文件转换为 WPF 的路径

xml - SVG animateMotion 沿圆而不是路径

javascript - 返回值返回为未定义

html - 具有透明度的 SVG