我有两个文本框,我需要有相同的文本,但字体不同。有什么方法可以同时编辑两者的文本内容(保持字体不同)。
Illustrator:同时编辑多个文本框中的文本
平面设计
adobe-illustrator
排版
文本
插画脚本
数据合并
2022-02-09 10:56:41
3个回答
您可以使用 XML 文件将文本动态加载到 Illustrator 中。
使用“变量”面板,您可以导入 XML 文件并使用它来控制对象的存在、链接图像容器中显示的图像以及文本框架中显示的文本。您还可以控制图表中显示的数据。典型的工作流程是创建一个模板文档,然后将其标记为变量。
网上有多个教程讨论如何做到这一点。这篇文章:HOW TO USE ADOBE ILLUSTRATOR VARIABLE DATA WITH XML有一个很好的视频和关于如何做到这一点的分步教程。
或者,您可以执行以下任一操作:
1) 删除第二个文本框。更改文本。复制 -> 粘贴文本并应用字体或字符样式。
或者
2) 完成第一个文本框的编辑后,只需将文本复制并粘贴到另一个文本框中即可。
您可以使用这个简短的脚本片段:
#target illustrator
function ChangeTextContents(){
if(app.documents.length > 0 && app.documents[0].selection != null){
var newText = prompt("Enter new text:", "");
if(newText != null){
var sel = app.activeDocument.selection;
for(var i=0; i<sel.length; i++){
var s = sel[i];
if(s.typename == "TextFrame"){
s.contents = newText;
}
};
}
}
}
ChangeTextContents();
它只会将您的输入文本放入您需要选择的文本框架中。
这是一个允许您选择组并更改这些组中的文本的修改。这适用于嵌套级别(组内的组)或直接在选定的文本层上。
#target illustrator
function ChangeTextContents(){
if(app.documents.length > 0 && app.documents[0].selection != null){
var newText = prompt("Enter new text:", "");
if(newText != null){
var sel = app.activeDocument.selection;
for(var i=0; i < sel.length; i++){
ChangeElement(sel[i],newText);
}
}
}
}
function ChangeElement(thisSelection,text) {
// For each selected item, determine if it is text or a group
// For text items, just change the contents
if(thisSelection.typename == "TextFrame"){
thisSelection.contents = text;
// For group items, iterate through each group item and recursive call this function.
} else if (thisSelection.typename == "GroupItem") {
// Change the text items within this level of the group
for(var k=0; k < thisSelection.textFrames.length; k++){
ChangeElement(thisSelection.textFrames[k],text);
}
// Now recursively process the group items within this group
for(var j=0; j < thisSelection.groupItems.length; j++){
ChangeElement(thisSelection.groupItems[j],text);
}
}
}
ChangeTextContents();
其它你可能感兴趣的问题