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
相关产品推荐
相关产品推荐

