UPD:我正在使用Photoshop CC 5
我正在编写一个用于替换Psd文本图层中的字符串的脚本。一切正常,但在某些层中,文本大小明显小于原始字符串。当我在更改内容之前和之后记录文本大小时,它们确实不同:
The old size and new size: 74.601448059082 pt : 38.3819046020508 pt
我尝试在var中保存旧大小,然后在更改内容后设置大小,但文本大小仍然是错误的(并且等于第二个值)。我做错了什么?
这是我用来替换字符串和记录的代码:
var originalString = layerSet.textItem.contents;
var replacementString = "";
replacementString = mmiFromLines(originalString, lines);
var oldSize = layerSet.textItem.size;
var oldKind = layerSet.textItem.kind;
layerSet.textItem.contents = replacementString;
log.writeln("The old size and new size: " + oldSize.value + " " + oldSize.type + " : " + layerSet.textItem.size.value + " " + layerSet.textItem.size.type);
log.writeln("Old kind vs new kind: " + oldKind + " : " + layerSet.textItem.kind);
layerSet.textItem.size = new UnitValue(oldSize.value, oldSize.type);
log.writeln("The new text size in the layer: " + layerSet.textItem.size.value + " " + layerSet.textItem.size.type);
log.writeln("_____________________________________________");