0

I am trying to ascertain the kerning of the characters in a TextFrame using IDS's SOAP API. For the sake of simplicity I am currently still trying to examine only the first character, which is not any kind of special character (it's an uppercase T). I am using this script to examine it:

var get_all_textframes = function(document, callback) {

      var looper = function(collection) {
        for(var i = 0; i < collection.textFrames.count(); i++) {
          var textframe = collection.textFrames.item(i);
          callback(textframe);
        }
      };

      var recurse = function(group) {
        for(var i = 0; i < group.groups.length; ++i) {
          looper(group.groups[i]);
          recurse(group.groups[i]);
        }
      };

      looper(document);
      recurse(document);
};

var document = app.open(File("c:\\path\\to\\idsdoc.indd"));

var output = "\n";
get_all_textframes(document, function(textframe) {
  if(textframe.id == 357) {
    output += ("Kerning: " + textframe.parentStory.characters[0].kerningValue+ " \n");
  }
});
document.close();

result.output = output;

However, when I run the script I get an error 30615: The property is not applicable in the current state.

It works fine if I try to get any other property from the character, rather than kerningValue. For example, kerningMethod returns Metrics.

What circumstance is causing this property to be unavailable, and how can I read it?

4

1 回答 1

1

只有将 kerningMethod 设置为“None”时,才能访问 kerningValue。此属性是一个字符串,可能因您的本地语言而异。您可以手动将 kerning 设置为 "O" => None 并要求 kerningMethod 确保正确的名称。

于 2015-07-28T14:12:53.700 回答