简体   繁体   中英

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

I am working on a js extend script for Adobe Indesign. I am facing a problem, which is weird, I dont know if its a Adobe Indesign bug or my problem.

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:

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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