Skip to main content
은정주2002854
Known Participant
November 25, 2023
Answered

Is it possible to get the leading value with a script if there are different font sizes in the text

  • November 25, 2023
  • 1 reply
  • 603 views

Is it possible to get the leading value from a textbox(textFrame) 

with a different font size than the leading  value with SCRIPT?

 

This topic has been closed for replies.
Correct answer m1b

Test sample file.
Thank you.


I don't know what's going on yet. Quite strange. Can you please try this and let us know what you see?

$.writeln("text/units = " + app.preferences.getIntegerPreference("text/units"));
$.writeln("text/asianunits = " + app.preferences.getIntegerPreference("text/asianunits"));

When I run it, I see:

text/units = 2
text/asianunits = 2

 

1 reply

m1b
Community Expert
Community Expert
November 25, 2023

Hi @은정주2002854, could you please try have a look at the leading of each character? Something like this:

(function () {

    var doc = app.activeDocument,
        textFrame = doc.textFrames[0],
        text = textFrame.textRange;

    for (var i = 0, len = text.length - 1; i <= len; i++) {
        var ch = text.characters[i];
        $.writeln(i + ': ch.leading = ' + ch.leading);
    }

})();

I think the effective leading  will be the maximum of the leading of the characters in the line.

 

If that doesn't help, could you please share your demo .ai file? (You can save as .pdf with illustrator editing capabilities.)

- Mark

은정주2002854
Known Participant
November 25, 2023

Why is the leading value 780 when it should be 250?

 

 

은정주2002854
Known Participant
November 25, 2023

Test sample file.
Thank you.