You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ExtendScript编写Illustrator脚本:解决可编辑文本描边裁切问题

在Illustrator ExtendScript中实现可编辑文本描边置于填充下方

当使用ExtendScript创建带描边的可编辑文本时,默认代码会让描边绘制在填充上方,导致字形被裁切。当前使用的代码如下:

textFrame.contents = 'foo'
textFrame.textRange.characterAttributes.textFont = textFont
textFrame.textRange.fillColor = black
textFrame.textRange.stroked = true
textFrame.textRange.strokeColor = white
textFrame.textRange.strokeWeight = 0.75

要解决这个问题并保持文本可编辑,只需在代码中添加strokeOverFill属性设置,将其值改为false即可——该属性专门控制描边与填充的绘制顺序:

textFrame.contents = 'foo'
textFrame.textRange.characterAttributes.textFont = textFont
textFrame.textRange.fillColor = black
textFrame.textRange.stroked = true
textFrame.textRange.strokeColor = white
textFrame.textRange.strokeWeight = 0.75
// 将描边置于填充下方绘制
textFrame.textRange.characterAttributes.strokeOverFill = false

补充说明

  • strokeOverFill是CharacterAttributes对象的内置属性,默认值为true(描边在填充上方),设置为false后,描边会被绘制在填充下方,完全匹配Illustrator界面中调整填充与描边顺序的效果。
  • 此方法无需对文本转曲或创建多层文本,可全程保持文本的可编辑状态。

内容的提问来源于stack exchange,提问作者superrache

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 21:16:13