Copy link to clipboard
Copied
Context: I have very basic experience with JavaScript. I mainly know HTML/CSS well.
Let's say I want to fill 1,000 pages with 1,000 phrases. One phrase per page, and the text has to fill the maximum amount of space in the page.
So I think I would need something like this: If "Hello there" is 60pt to fill the page, but the next page contains "How are you?" dynamically change the font size to fit the page (like 40pt). Am I on the right track or should I do something else?
I understand this may have something to do with strings and character counts. I have found some clues in JavaScript but also need help changing some of the language to work in InDesign.
jquery - Change Font Size dynamically based on Character count - Stack Overflow
jquery - Auto-size dynamic text to fill fixed size container - Stack Overflow
Copy link to clipboard
Copied
In looking for a script to dynamically change text color, I found this:
Fun With Text Fitting in InDesign | in-tools.com
It's a link to a script and directions to fit text within a given frame size (in your example, the frame size could be the whole page).
Copy link to clipboard
Copied
Character count is not a useful way to fit text in a frame. You can change the type size in small steps until the text fits the frame. Or better yet, check Marc Autret's site, he had a function (which I think he also showed in this forum), which uses a more sophisticated method to fit text to a frame. I don't have a link to that specific function -- Marc's site is at www.indiscripts.com.
P.
Copy link to clipboard
Copied
Hi Peter,
I think this is the article:
Indiscripts :: On Dichotomic Divide-and-Conquer Algorithms
Regards,
Uwe
Copy link to clipboard
Copied
Yes, Uw, that's the one. Thanks for posting the link.
P.
Copy link to clipboard
Copied
Though it's about resizing the frame, not the type size, the method would be comparable. (Can't edit messages for some reason.)
Copy link to clipboard
Copied
Hi Peter,
one link in the article is leading to this discussion:
Overflows property update process
Regards,
Uwe
Find more inspiration, events, and resources on the new Adobe Community
Explore Now