【问题标题】:How can I change font of currently selected text using Adobe Illustrator Extendscript?如何使用 Adob​​e Illustrator Extendscript 更改当前选定文本的字体?
【发布时间】:2019-10-21 03:34:30
【问题描述】:

我想更改当前选定文本元素的字体。

这是我尝试过的代码:

var sel = app.activeDocument.selection; 
for (i = 0 ; i<sel.length ; i++) 
     { 
          sel[i].textRange.characterAttributes.textFont = textFonts.getByName("Arial");
     } 

这是我得到的错误:

Error 1302: No such element

-> sel[i].textRange.characterAttributes.textFont = textFonts.getByName("Arial");

如何获得所选内容的 textFont 元素?谢谢!

【问题讨论】:

    标签: javascript fonts adobe-illustrator extendscript


    【解决方案1】:

    好的,如果你没有确切的字体名称,它会抛出错误。在这种情况下,字体名称是“ArialMT”。现在可以了。

    【讨论】:

    • 您应该将答案标记为“正确”,以便其他人知道此问题已得到回答
    猜你喜欢
    • 1970-01-01
    • 2021-04-09
    • 1970-01-01
    • 1970-01-01
    • 2013-07-07
    • 1970-01-01
    • 2014-01-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多