Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Using Dynamic Text Variables - Need text to resize automatically

Community Beginner ,
Oct 06, 2020 Oct 06, 2020

The latest version of Illustrator.

I am using batch actions to create many graphics versions with dynamic text and I am using an XML file to input the dynamic text variables. Some of the text is too long and goes beyond the artboard. I am trying to figure out a way to dynamically change the size of the text so that it will always fit within a defined width.

 

I haven't had any luck finding out if this is possible in Illustrator. 

 

Thank you in advance for your help!

Mike

TOPICS
Draw and design , Scripting , Tools
4.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Oct 07, 2020 Oct 07, 2020

You can use this script of mine for shrinking the text, a very common problem.

https://github.com/Silly-V/Adobe-Illustrator/blob/master/Dataset%20Processing/DealWithOversetText_SingleLine.jsx

Translate
Adobe
Community Expert ,
Oct 07, 2020 Oct 07, 2020

Maybe you can detail the process a little further?

Also show the template document you use - are there point texts in it or area texts?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 07, 2020 Oct 07, 2020

I've tried area and point text and neither resized the text to keep it within the area I defined. The screenshot below is a area type example of how the text adds rows when the text is to long to fit and uses the same text size. 

 

Mike5FA5_0-1602081390364.pngexpand image

 

Point type example below and how the text reacts to lengths longer than will fit.

Mike5FA5_1-1602081585011.pngexpand image

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 07, 2020 Oct 07, 2020

I found this request in the Illustrator feature requests. https://illustrator.uservoice.com/forums/333657-illustrator-feature-requests/suggestions/37449973-re...

 

I've tried a couple of scripts I found that was supposed to do this but none of them produced any changes. If the option doesn't exist is there a script that will adjust the text size to that of the text box for longer text for variable input purposes

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Oct 07, 2020 Oct 07, 2020

You can use this script of mine for shrinking the text, a very common problem.

https://github.com/Silly-V/Adobe-Illustrator/blob/master/Dataset%20Processing/DealWithOversetText_Si...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 07, 2020 Oct 07, 2020

Hi Silly-V,

I came across your scripts last night. The problem maybe I don't know how to use scripts properly in Illustrator. 

 

I copied your script into a new BBedit text document and saved it with the .JSX extension (see screenshot below).

 

Mike5FA5_0-1602088022080.pngexpand image

 

I opened the existing artboard then I click File/Scripts/Other Scripts then navigate to the folder I saved DealWithOversetText_SingleLine.jsx. I then click on the area type text box and cycle through the variables. The characters don't resize and respond the same way they did before I loaded the script. I must not be doing something right.

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 07, 2020 Oct 07, 2020

I went back and quit Illustrator and copied the script into the scripts folder under /Applications/Adobe Illustrator 2020/Presets.localized/en_US/Scripts. I restarted Illustrator and loaded the script File/Scripts then clicked on DealWithOversetText_SingleLine.jsx. I created a new area type text box with the same results. I then changed the text box to point type with the same results. 

 

What am I doing wrong?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Oct 07, 2020 Oct 07, 2020

This script is intended to be called by an action during the batch action process. It has to be stuck into your File/Scripts menu, which is a folder in your Illustrator application - wherever that is at. When you restart Ai, the new script menu item will appear and now you can use the actions' flyout menu to "Insert Menu Item" and thus add the script to the action. When you run the batch action, first the text will be replaced by Illustrator and then the action will play the script which will resize the text down to its box.

You can actually record an action which automatically cycles to next dataset and plays the script. This is what I call a "Preview" action because you can change datasets and play the script to test with without exporting a lot of files.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Oct 07, 2020 Oct 07, 2020

And a special feature of the script is to record the font size which is used in your text boxes IF you are on the very first dataset. If this is recorded (and it gets recorded every time this script runs and you are on the first dataset), then the next time it will reset your text to that size. This feature is for when your text is so long that it gets shrunk, but the next dataset's text is shorter and you don't want it to still remain small, it should occupy the whole box.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 07, 2020 Oct 07, 2020

Thank you for the explanation. The script worked great! 

 

Solutions many times lead to new questions Haha

Some of the titles are so long they wind up very small. Is there a way to add a row in the script if the size falls below a certain character size?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Oct 07, 2020 Oct 07, 2020

That would take some customized work. There are some wacky hacky almost work-arounds (https://www.linkedin.com/pulse/vertical-text-centering-via-forced-thread-reflow-vasily-hall/) but for this kind of requirement would be best if someone took all your cases and worked with you to make your perfect variable-data thing. Because now it's a matter of sizing different lines to make sure one isn't bigger than the other, and the biggest one is the line flush with the box - plus you probably don't want words to be split awkwardly, so there's got to be some logic deciding on how exactly to handle the splitting and whether some words belong together, etc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 07, 2020 Oct 07, 2020
LATEST

Thank you, I appreciate all of your help!

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines