【问题标题】:Select all objects with font-size between two sizes in illustrator?在illustrator中选择字体大小介于两种大小之间的所有对象?
【发布时间】:2018-09-27 02:06:58
【问题描述】:

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

【问题讨论】:

    标签: adobe-illustrator


    【解决方案1】:

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

    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 );
    

    希望对你有帮助,

    洛伊克

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-07-17
      • 1970-01-01
      • 2011-03-27
      • 2020-12-06
      • 2015-03-17
      • 1970-01-01
      • 2012-05-27
      相关资源
      最近更新 更多