将文本追加到同一单元格后,表格单元格中的Indesign字形消失了

问题描述 投票:0回答:1

我正在为Adobe Indesign开发js扩展脚本。我遇到一个奇怪的问题,我不知道这是Adobe Indesign错误还是我的问题。

情况是:我必须在表中插入一些特殊字符,所以我必须使用查找和更改字形方法将那些特殊字符插入到该表的单元格中:

month12day29.contents = "¢";
app.findChangeGlyphOptions.includeMasterPages = true;
month12day29.characters.everyItem().appliedParagraphStyle ="前ー月大丸";
month12day29.characters[0].properties={appliedFont : 'A-OTF Futo Go B101 Pro',fontStyle: 'Bold'}
app.findGlyphPreferences.appliedFont= 'A-OTF Futo Go B101 Pro';
app.findGlyphPreferences.fontStyle= 'Bold';
app.findGlyphPreferences.glyphID = 102;   //Character:  ¢
app.changeGlyphPreferences.glyphID=8103;  //Desired character, there is no unicode for this, i cant insert it directly, so i have to insert it by glyphs
app.changeGlyphPreferences.appliedFont= 'A-OTF Futo Go B101 Pro';
app.changeGlyphPreferences.fontStyle= 'Bold';
month12day29.characters[0].changeGlyph();
month12day29.characters.everyItem().appliedParagraphStyle ="前ー月大丸";   // same Font A-OTF Futo Go B101 Pro

上面的部分还可以,但是当我尝试向该单元格添加文本时,插入的字符消失了

month12day29.contents +="\r";  /// the Desired chacter above some how got deleted after this line execute

我想问:

  • 什么问题?

  • 如何解决这个问题?

谢谢,抱歉我的英语不好!

javascript adobe adobe-indesign extendscript
1个回答
0
投票

由于您正在处理的是一个甚至没有Unicode的奇异字形,所以可能是JS串联失败了。

在这种情况下,您可以将要附加的字符串插入到表格单元格的最后一个插入点。因此,您可以按原样保留脚本,但在最后一步,请执行以下操作:

month12day29.insertionPoints.lastItem().contents = "\r";

这基本上将插入的字形保留下来,只是在其后面放置一些东西。

© www.soinside.com 2019 - 2024. All rights reserved.