Copy link to clipboard
Copied
I saw scripts that adapt a box to the amout of text, but i'am looking for a script that does it the other way arround.
I have a amout of text that has to fit in a predefined box for example 50 x 30 mm.
The script has to slove the text overflow issue by adapting the fontsize.
Is this possible?
Cheers Daniel
Copy link to clipboard
Copied
Something like this, with underscore.js
#include "underscore.js"
var t = app.selection[0], l = t.contents.replace(/\r/g, '').length;
while (l != _.reduce(t.lines, function(memo, line){ return memo + line.characters.length; }, 0))
t.textRange.characterAttributes.size = t.textRange.characterAttributes.size * 0.98;
Copy link to clipboard
Copied
Cool gona try it, thankx moluapple.
Daniel
Copy link to clipboard
Copied
Wait, the last line can just be:
t.textRange.characterAttributes.size *= 0.98;