Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Text 更改字体系列也会更改字体大小_Text_Font Face_Photoshop_Font Size_Extendscript - Fatal编程技术网

Text 更改字体系列也会更改字体大小

Text 更改字体系列也会更改字体大小,text,font-face,photoshop,font-size,extendscript,Text,Font Face,Photoshop,Font Size,Extendscript,我有很多PSD文件,里面有一些文本,我需要将它们的字体系列更改为另一个。我在网上找到了一个代码片段,并根据我的需要对它进行了调整——它确实改变了我想要的字体系列,但它也改变了字体大小,即使我在代码中没有改变它。我错过什么了吗 我使用的是PhotoshopCS6 64位+Windows7 64位 脚本代码: if (app.documents.length > 0) { for (var n = 0; n < app.documents.length; n++) {

我有很多PSD文件,里面有一些文本,我需要将它们的字体系列更改为另一个。我在网上找到了一个代码片段,并根据我的需要对它进行了调整——它确实改变了我想要的字体系列,但它也改变了字体大小,即使我在代码中没有改变它。我错过什么了吗

我使用的是PhotoshopCS6 64位+Windows7 64位

脚本代码:

if (app.documents.length > 0) {
    for (var n = 0; n < app.documents.length; n++) {
        app.activeDocument = app.documents[n];
        app.activeDocument.suspendHistory("Change font", "main()");
    }
}

function main () {
    var myDocument = app.activeDocument;
    var theLayers = collectTextLayers(myDocument, []);

    if (theLayers.length > 0) {
        for (var a = 0; a < theLayers.length; a++) {
            theLayers[a].textItem.font = "Lato-Regular";
        }
    }
}

function collectTextLayers (theParent, allLayers) {
    if (!allLayers) {
        var allLayers = new Array;
    }

    for (var m = theParent.layers.length - 1; m >= 0;m--) {
        var theLayer = theParent.layers[m];

        if (theLayer.typename == "ArtLayer") {
            if (theLayer.kind == LayerKind.TEXT) {
                allLayers.push(theLayer);
            }
        } else {
            allLayers = (collectTextLayers(theLayer, allLayers));
        }
    }

    return allLayers;
}
if(app.documents.length>0){
对于(var n=0;n0){
对于(var a=0;a=0;m--){
var theLayer=父层[m];
if(theLayer.typename==“ArtLayer”){
if(theLayer.kind==LayerKind.TEXT){
所有层。推(层);
}
}否则{
allLayers=(collectTextLayers(theLayer,allLayers));
}
}
返回所有层;
}

您确定它正在更改字体大小还是看起来就是这样?不同的字体可能看起来有点不同的高度,即使它们是用相同的em大小设计的。我确信,当我在Photoshop中更改字体时,更改前后的文本大小是相同的。更具体地说,我正在将字体转换为Lato-Regular。你确定这是在改变字体大小还是看起来就是这样?不同的字体可能看起来有点不同的高度,即使它们是用相同的em大小设计的。我确信,当我在Photoshop中更改字体时,更改前后的文本大小是相同的。更具体地说,我将字体转换为Lato Regular。