【问题标题】:My font keep revert to "Times new roman" But I'm I set "Metropolis" in the script我的字体一直恢复为“Times new roman”但我在脚本中设置了“Metropolis”
【发布时间】:2022-07-14 20:00:44
【问题描述】:
var parent = app.project.activeItem;

for(var i = 0; i < parent.layers.length; i++){
        var mySourceText = parent.layer(i + 1).property("ADBE Text Properties").property("ADBE Text Document");
        var textProp = parent.layer(i + 1).property("Source Text");
        var currentValue = textProp.value;
        if(currentValue.toString().match(/[a-z]/i)){
            currentValue.font = "Bodoni-BoldMT";
            currentValue.fontSize = 125;
            textProp.setValue(currentValue);
            $.writeln("alpha hai ", currentValue)
        }else if(currentValue.toString().match(/[0-9]/i)){
            var myTextDoc = mySourceText.value;
            myTextDoc.fontSize = 100;
            myTextDoc.font = "Metropolis-Bold";
            myTextDoc.fillColor = [0.5,0.5,0];
            mySourceText.setValue(myTextDoc);  
            $.writeln("number hai ", currentValue)
        }else if(currentValue.toString().match(/[+\-=]/i)){
            currentValue.font = "Times New Roman";
            $.writeln("Arrtmathic hai ", currentValue)
        }else{
           $.writeln("Missed ", currentValue)
        }
}

【问题讨论】:

  • 它可能正在恢复,因为您的字体无法呈现数据引用的特定字形。在这种情况下,您的字体选择将恢复为默认值。并非所有字体都设计有每一个 UTF-8 字形。
  • 感谢您的回复,但我通过从 after effects 中选择字体名称解决了这个问题。当您从 after effects 中选择特定字体时,它会返回一个带有一些前缀的名称,这将起作用

标签: adobe extendscript after-effects


【解决方案1】:

在我看来,字体名称拼写错误。尝试先设置必要的值,然后从中提取所有正确的值。 enter image description here

【讨论】:

    最近更新 更多