简体   繁体   English

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

[英]Indesign Glyphs in table cell disappeared after append text to the same cell

I am working on a js extend script for Adobe Indesign.我正在为 Adob​​e Indesign 编写 js 扩展脚本。 I am facing a problem, which is weird, I dont know if its a Adobe Indesign bug or my problem.我正面临一个问题,这很奇怪,我不知道是 Adob​​e Indesign 错误还是我的问题。

The case is: I have to insert some special character to a table, so i have to use find and change Glyphs method to insert those special character in to that table's cell:情况是:我必须在表格中插入一些特殊字符,所以我必须使用 find 和 change Glyphs 方法将这些特殊字符插入到该表格的单元格中:

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

The above part is ok, but when i try to append text to that cell, The inserted character disappeared以上部分没问题,但是当我尝试将文本附加到该单元格时,插入的字符消失了

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

I want to ask:我想问一下:

  • What is the problem?问题是什么?

  • How to work around this?如何解决这个问题?

Thank you and sorry for my bad english!谢谢你,对不起我的英语不好!

Since you are dealing with such an exotic glyph that does not even have a unicode, it's probably the JS concatenation that is failing.由于您正在处理这种甚至没有 unicode 的奇特字形,因此可能是 JS 连接失败了。

In this case you could insert the string you want to append into the table cell's last insertion point.在这种情况下,您可以将要附加到表格单元格的最后一个插入点的字符串插入。 So you can leave your script as is, but as a last step you do this instead:所以你可以保留你的脚本,但作为最后一步,你可以这样做:

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

This basically leaves the inserted glyph alone and just places something behind it.这基本上让插入的字形单独存在,只是在它后面放了一些东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM