Take the 2-minute tour ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

I have several hundred Illustrator files that are formatted similarly, and for legal reasons I need to replace a font in all of them. Even with the 'Find font' tool, that's a hell of a lot of fonts to replace by hand.

Is there some way of automating it? For example, using Bridge? Illustrator (CS5) doesn't offer many options in Bridge, compared to the automation options offered by Photoshop. I also don't see any option for running actions on multiple Illustrator files.

Also, creating a repeatable action for replacing the font doesn't seem to work: instead of repeating my action, it brings up the dialog box an waits for me to tell it to replace them.

As a programmer I'm prepared to edit the files directly if it can be done without breaking them.


Update: The 'Batch...' menu item from Illustrator's actions panel menu allows the same action to be performed on a folder of files. It doesn't fix the Find Fonts action waiting for input though. Toggling the dialog off makes the action do nothing at all.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

You might take a look at scripting.

This link is to the Adobe forums with a discussion regarding scripts to alter fonts in Illustrator CS4. The same scripts should function in CS45 or CS6.

Illustrator Scripting Reference (click here)

share|improve this answer
    
I had no idea you could use Javascript to control Adobe apps. I knew about the AppleScript equivalent, and was starting to eye one of the Macs in the office for this purpose. –  Marcus Downing May 15 '12 at 8:03
1  
Okay, there's a good reason for that. It's really badly documented. –  Marcus Downing May 16 '12 at 23:06
    
I assume you looked here: adobe.com/devnet/illustrator/scripting.html –  Scott May 21 '12 at 20:01
    
Yes, but that's pretty rough documentation compared to a lot of modern languages. It took a lot of trial and error, but this approach is starting to work for me - it is replacing fonts. I'll post the complete script when I've finished it. –  Marcus Downing May 22 '12 at 0:22
    
I've accepted your answer, but added an answer of my own with the detailed solution I worked out. –  Marcus Downing May 23 '12 at 22:55
add comment

Using Actions may help, and is a good strategy if you can get it to work (Actioning several Find Font commands for all the different type styles you have).


Another method, if you're game, is using a text editor to edit the documents. It's a bit more risky, but could certainly blast through thousands of documents in a very short space of time.

Here's some steps that might get you started.

  1. Duplicate all the documents you wish to edit. I can't stress this enough... there's a very good chance you'll do some serious damage if you're not careful, so you'll want to work on copies.

  2. Depending on the text editor you're using, you may need to rename all the files to be .txt rather than .ai. If you're using OS X, Apple's free Automator app can do this (it's in your Applications folder already). The Automator Action you want is Rename Finder Items.

  3. Open up one of the documents in a good text editor that can Find and Replace across documents. You'll probably want something like BBEdit, Coda, Espresso, TextMate or a similar editor that's for programming. I generally use Code for this type of thing.

  4. Find the portions of code that contain the font info. Adobe Illustrator .ai files contain some XML that's probably the bit you'd like to change, so they should be pretty easy to work with. I just saved a document with some text in it. Here's some of the XML in my document that shows the font (you may need to change several places).

 <rdf:li rdf:parseType="Resource">
    <stFnt:fontName>MyriadPro-Regular</stFnt:fontName>
    <stFnt:fontFamily>Myriad Pro</stFnt:fontFamily>
    <stFnt:fontFace>Regular</stFnt:fontFace>
    <stFnt:fontType>Open Type</stFnt:fontType>
    <stFnt:versionString>Version 2.006;PS 002.000;Core 1.0.38;makeotf.lib1.6.6565</stFnt:versionString>
    <stFnt:composite>False</stFnt:composite>
    <stFnt:fontFileName>MyriadPro-Regular.otf</stFnt:fontFileName>
 </rdf:li>

  1. Rename all your files back to .ai.

You'll have to experiment a lot. You'll probably want to edit one document to see what the before and after look like, then try to automate it with one or several Find and Replace actions.

Once you have it working, you can apply that across all your files (remember, on the copies, not the original files!).

Is that going to work? Is it worth your time? Maybe yes, maybe no. It depends if this is a regular thing you need to do, how comfortable you are with the method and how many files you have.

Please note that changing the font will likely move elements and text may be significantly reflowed.

share|improve this answer
1  
I'm fond of Sublime Text 2 myself. –  Marcus Downing May 15 '12 at 7:30
1  
"It depends if this is a regular thing you need to do, how comfortable you are with the method and how many files you have." - I'm comfortable with a text find-replace, yes. I should only have to do this once, but it does affect a lot of files. –  Marcus Downing May 15 '12 at 7:53
1  
"Adobe Illustrator .ai files are XML" - Not quite, they're a Postscript derivative that has some embedded XML in the header. –  Marcus Downing May 15 '12 at 8:01
    
@MarcusDowning Thanks for the clarification. I'll edit the reply to match your comment. You're right, AI PDF (.ai) files don't seem to be all XML. I guess you could save as EPS as well (also not XML!). –  Marc Edwards May 15 '12 at 10:39
    
I'd love to know how you go with this, because I haven't done it myself... I just thought that it should be possible, given what you're after. –  Marc Edwards May 15 '12 at 10:56
show 5 more comments

To expand on the accepted answer, here are some scripts that I've worked out to do the job.

Use the first script to get the exact name of the fonts that are being used. Then edit the array at the top of the second script with the names of fonts you want to substitute.

var substitutions = [
  ['BellGothic BT', 'Bold',         'Roboto', 'Condensed'],
  ['BellGothic Blk BT', 'Black',    'Roboto', 'Bold Condensed'],
];

Note that on large folders these scripts might take a long time.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.