11 Replies Latest reply on Feb 1, 2017 3:42 AM by Kasyan Servetsky

    Universal font change in all documents?

    creativet469279

      Hi,

       

      We've recently changed the fonts we use for all of our company collateral. We are changing from an old, outdated TT file set of Helvetica Neue to the current OT family that Linotype offers. Same face, different font files.

       

      Every * little * thing * we publish uses these fonts and now I have the problem of updating tens of thousands of native files with the new font links. Is there a way universally update in InDesign and Illustrator so that my native files using font set A automatically update to font set B? I don't want to loose hours of my life clicking around in individual files to relink everything.

       

      I've done some poking around and not found any answers to this question. Any help or redirect would be appreciated.

       

      Thanks,

       

      AR

        • 1. Re: Universal font change in all documents?
          Szalam Adobe Community Professional & MVP

          I've moved this thread from the (fairly quiet) Type & Typography since this isn't really a question about type, but more of a question about how to use Adobe software. Thus it is now in a product-specific support forum. I would recommend you create a post in the Illustrator forum as well since the answer is likely to be different for each software.

           

          That being said, perhaps this would be a question for Illustrator Scripting or InDesign Scripting, but I'm not familiar enough with either of them to know for sure.

          • 2. Re: Universal font change in all documents?
            Willi Adelberger Most Valuable Participant

            I hope you work with a logical build up Paragraph and Character styles with the very same name in every document. Import these styles from a clean source document and overwrite the existing styles. Otherwise, you have to do the hard work, document by document with find and replace font, and replace them.

            • 3. Re: Universal font change in all documents?
              rob day Adobe Community Professional & MVP

              For InDesign documents you can use Type>Find Font... (not Find/Change) which lets you change a document's fonts with the option of updating any styles that use the font with one click. It is certainly scriptable and one likely exists, so ask in the scripting forums.

               

              Screen Shot 2017-01-26 at 10.28.15 AM.png

              • 4. Re: Universal font change in all documents?
                Kasyan Servetsky Level 5

                It looks like a very interesting idea for making a script.

                I wrote a quick & dirty script for changing fonts which should be used together with my new Batch processor.

                Here I posted the script and before and after sample documents (ver. CC 2017).

                In the future I'm going to make a more user friendly version so the user could prepare a list of the fonts to be changed, say in Excel (optionally), and save it as CSV-file which will be used by the script. But so far you have to make minor edits to the script:

                At the very beginning you'll see the first variable which is the array of arrays containing the names of the fonts in the format

                [ "Find this", "Change to this" ],

                29-01-2017 16-04-47.png

                Here I used the fonts installed with InDesign to make sure that everybody have them and can test the script using my sample.

                The left element is 'Find this', the right one is 'Change to'.

                The family name and font style should be separated by a tab: either \t or by actual tab (by hitting tab on the keyboard)

                The find-change pairs (the elements of array) are separated by commas so make sure that you won't leave a comma after the last element (see the screenshot above).

                Then you can select the script in the Batch processor like so:

                29-01-2017 15-54-47.png

                The 'change fonts' script does the following:

                1. changes the fonts in all the paragraph styles
                2. changes the fonts in all the character styles
                3. changes the fonts applied as a local formatting in the same way as the 'find this font and change to that font' feature works in the Find-Change Text dialog box. Note: to illustrate this point, the first paragraph in my sample is set to Letter Gothic Std  and Minion Pro - Bold, Italic and Bold Italic.

                 

                The script changes Minion Pro - Bold, Italic and Bold Italic to Myriad Pro (Letter Gothic Std obviously is left unchanged).

                Before

                29-01-2017 16-54-35.png

                After

                29-01-2017 16-54-19.png

                Here's the script:

                var fontList = [
                    ["Minion Pro\tRegular", "Myriad Pro\tRegular"],
                    ["Minion Pro\tBold", "Myriad Pro\tBold"],
                    ["Minion Pro\tItalic", "Myriad Pro\tItalic"],
                    ["Minion Pro\tBold Italic", "Myriad Pro\tBold Italic"]
                ];
                    
                main();
                
                function main() {
                    try { // if something goes wrong in the try-catch block, the batch processor won't stop here. It will log the error message and continue further
                        
                        var newFont, paragraphStyle, characterStyle,
                        doc = app.activeDocument, // The frontmost document
                        paragraphStyles = doc.allParagraphStyles,
                        characterStyles = doc.allCharacterStyles;
                        
                        // Change in paragraph styles
                        for (var p = 1; p < paragraphStyles.length; p++) {
                            paragraphStyle = paragraphStyles[p];
                            newFont = getNewFont(paragraphStyle.appliedFont.name);
                            if (newFont != null) {
                                paragraphStyle.appliedFont = newFont;
                            }
                        }
                
                        // Change in character styles
                        for (var c = 1; c < characterStyles.length; c++) {
                            characterStyle = characterStyles[c];
                            newFont = getNewFont(characterStyles[c].appliedFont + "\t" + characterStyles[c].fontStyle);
                            if (newFont != null) {
                                characterStyles[c].appliedFont = newFont;
                            }
                        }
                        
                        for (var i = 0; i < fontList.length; i++) {
                            var changed;
                            app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
                            app.findTextPreferences.appliedFont = fontList[i][0];
                            app.changeTextPreferences.appliedFont = fontList[i][1];
                            changed = doc.changeText();
                            app.findTextPreferences = app.changeTextPreferences = NothingEnum.NOTHING;
                        }
                
                    }
                    catch(err) { // if an error occurs, catch it and write the  document's name, error message and line# where it happened into the log
                        gErrorLog.push(doc.name + " - " + err.message + ", line: " + err.line);
                    }
                }
                
                function getNewFont(oldFontName) {
                    var newFont = null;
                    
                    for (var p = 0; p < fontList.length; p++) {
                        if (oldFontName == fontList[p][0]) {
                            newFont = app.fonts.itemByName(fontList[p][1]);
                            if (!newFont.isValid) {
                                newFont = null;
                            }
                            break;
                        }
                    }
                
                    return newFont;
                }
                

                 

                Hope this helps.

                 

                — Kasyan

                2 people found this helpful
                • 5. Re: Universal font change in all documents?
                  Laubender Adobe Community Professional & MVP

                  Hi Kasyan,

                  thank you for posting this.

                   

                  Maybe you could use the arrays allParagraphStyles and allCharacterStyles to include cases where the styles are stored in groups.

                   

                  Thanks,
                  Uwe

                  • 6. Re: Universal font change in all documents?
                    Kasyan Servetsky Level 5

                    Hi Uwe,

                     

                    I do use them in the script.

                     

                    Regards,
                    Kasyan

                    • 7. Re: Universal font change in all documents?
                      Laubender Adobe Community Professional & MVP

                      Oops… Sorry. Did not check that…
                      Lines 15 and 16.

                       

                      Uwe

                      • 8. Re: Universal font change in all documents?
                        Dov Isaacs Adobe Employee

                        You are making a terrible assumption here, that the “old, outdated TT file set of Helvetica Neue” that you currently have installed and are using is really the exact same font as “the current OT family that Linotype offers.”

                         

                        Ignoring all the wonderful advise offered by other contributors to this thread, you should be aware that just because the name Helvetica Neue is the same, you cannot assume that the font metrics and the encodings are the same.

                         

                        Differences in metrics including set widths of particular characters and pair kerning tables may very well lead to different line and page breaks.

                         

                        Differences in encodings between the old and new fonts may result in the wrong characters and/or the .notdef glyph (the box with the X in it) displaying and printing after you actually do the substitution.

                         

                        You will need to go through your documents and look for these possible discrepancies!

                         

                                  - Dov

                        1 person found this helpful
                        • 9. Re: Universal font change in all documents?
                          rob day Adobe Community Professional & MVP

                          Another, maybe safer, script strategy would be modify the find and change script to be a startup script with no save line. So it would check docs on open for the old Helevetica and if an instance exists, make the change and throw up a warning dialog. Then it would be up to the user to check the file before saving.

                          • 10. Re: Universal font change in all documents?
                            Kasyan Servetsky Level 5

                            I think my approach is quite safe: with the 'Backup original documents' check box ON, the batch processor never overwrites the originals, even if you run the script many times.

                            30-01-2017 17-41-31.png

                            The screenshot above illustrates what happens after running it 5 times:

                            Backup_Test-Before.indd -- is the original version

                            Test-Before.indd -- is the latest version

                            Backup(X)_Test-Before.indd -- intermediate versions

                             

                            — Kas

                            • 11. Re: Universal font change in all documents?
                              Kasyan Servetsky Level 5

                              I've made a new version. Now the user can prepare a list of the fonts to be changed, say in Excel (optionally), and save it as CSV-file which will be used by the script, or you can edit it directly in the CSV-file using a plain text editor like Notepad (PC) or TextEdit (Mac).

                               

                              — Kas