6 Replies Latest reply on Jun 17, 2009 8:09 AM by Nathan Bress

    "font family not available" error (15875)

      Hi all-

      So whenever I place copy into an InDesign document, I've been running a JS script I wrote to find and correct any examples of missing fonts. This has been working fine for me for about a year, but now I've run into a challenge - I'm trying to get the same script to run on a coworker's machine, and it's not working. The line it's choking on is app.findTextPreferences.appliedFont="Helvetica Neue LT Std" - when it hits this spot I get an error "The requested font family is not available." But the thing is, I'm not sure why not - it shows up in the pull-down font list under the same name on both her computer and mine. We're both using the same OS, the same version of InDesign (CS3), the same version of the font, working on the same document, etc. Furthermore, "app.selection[0].appliedFont.postscriptName" and "app.selection[0].appliedFont.postscriptName" return the same results on both machines ("HelveticaNeueLTStd-Roman" and "Helvetica Neue LT Std [tab] 55 Roman", respectively). Anybody have any bright ideas as to why we're then getting an error on one machine but not the other when all other factors appear to be equal?


        • 1. Re: "font family not available" error (15875)
          Larry G. Schneider Adobe Community Professional & MVP
          Where are the fonts installed? Are they in the same place on both machines?
          • 2. Re: "font family not available" error (15875)
            Level 1
            Yep, they're in C:\Windows\Fonts on both computers.
            • 3. Re: "font family not available" error (15875)
              Fred Goldman Level 3
              Sometimes, for no apparent reason, you have to type the font name like this:

              "Helvetica Neue LT Std\tRoman"
              • 4. Re: "font family not available" error (15875)
                Level 1
                Thanks, Fred - I tried that and a couple of other permutations of the same idea, and still no luck.
                • 5. Re: "font family not available" error (15875)
                  Hi Nathan,

                  If you have a somewhat working script, you should share it with us!


                  • 6. Re: "font family not available" error (15875)
                    Nathan Bress

                    Hi JohnR-


                    Sorry, over a year later, I finally checked back on this thread and saw your request. I did indeed come up with a workable solution after some more tinkering, which I've posted below. It's pretty specific to the fairly controlled environment I'm working in - if you ran this on a document with a different set of paragraph styles from what we're using, you'd get errors - but the methodology should be applicable to other environments with some modifications. Hope it's useful to others.

                    var FindAppliedParagraphStyle=new Array()
                    var FindAppliedFont=new Array()
                    var FindAppliedFontStyle=new Array()
                    var ReplaceFontStyle=new Array()
                    //change all instances of Symbol font to Regular
                    app.findTextPreferences = null;     app.changeTextPreferences = null;
                    //define styles to be replaced. 
                    FindAppliedParagraphStyle[0]="Abstract"; FindAppliedFont[0]="Helvetica Neue LT Std"; FindAppliedFontStyle[0]="Bold Italic"; ReplaceFontStyle[0]="66 Medium Italic";
                    FindAppliedParagraphStyle[1]="Abstract"; FindAppliedFont[1]="Helvetica Neue LT Std"; FindAppliedFontStyle[1]="Bold"; ReplaceFontStyle[1]="65 Medium";
                    FindAppliedParagraphStyle[2]="Abstract"; FindAppliedFont[2]="Helvetica Neue LT Std"; FindAppliedFontStyle[2]="Regular"; ReplaceFontStyle[2]="65 Medium";
                    FindAppliedParagraphStyle[3]="Para_Text"; FindAppliedFont[3]="Helvetica Neue LT Std"; FindAppliedFontStyle[3]="Italic"; ReplaceFontStyle[3]="56 Italic";
                    FindAppliedParagraphStyle[4]="Para_Text"; FindAppliedFont[4]="Helvetica Neue LT Std"; FindAppliedFontStyle[4]="Regular"; ReplaceFontStyle[4]="55 Roman";
                    FindAppliedParagraphStyle[5]="Flush_Left"; FindAppliedFont[5]="Helvetica Neue LT Std"; FindAppliedFontStyle[5]="Italic"; ReplaceFontStyle[5]="56 Italic";
                    FindAppliedParagraphStyle[6]="Flush_Left"; FindAppliedFont[6]="Helvetica Neue LT Std"; FindAppliedFontStyle[6]="Regular"; ReplaceFontStyle[6]="55 Roman";
                    FindAppliedParagraphStyle[7]="Bib_Reference"; FindAppliedFont[7]="Helvetica Neue LT Std"; FindAppliedFontStyle[7]="Italic"; ReplaceFontStyle[7]="56 Italic";
                    FindAppliedParagraphStyle[8]="Bib_Reference"; FindAppliedFont[8]="Helvetica Neue LT Std"; FindAppliedFontStyle[8]="Regular"; ReplaceFontStyle[8]="55 Roman";
                    FindAppliedParagraphStyle[9]="Figure_Leg_Cont"; FindAppliedFont[9]="Helvetica Neue LT Std"; FindAppliedFontStyle[9]="Italic"; ReplaceFontStyle[9]="56 Italic";
                    FindAppliedParagraphStyle[10]="Figure_Leg_Cont"; FindAppliedFont[10]="Helvetica Neue LT Std"; FindAppliedFontStyle[10]="Regular"; ReplaceFontStyle[10]="55 Roman";
                    FindAppliedParagraphStyle[11]="Figure_Legend"; FindAppliedFont[11]="Helvetica Neue LT Std"; FindAppliedFontStyle[11]="Italic"; ReplaceFontStyle[11]="76 Bold Italic";
                    FindAppliedParagraphStyle[12]="Figure_Legend"; FindAppliedFont[12]="Helvetica Neue LT Std"; FindAppliedFontStyle[12]="Regular"; ReplaceFontStyle[12]="75 Bold";
                    FindAppliedParagraphStyle[13]="TableLegend"; FindAppliedFont[13]="Helvetica Neue LT Std"; FindAppliedFontStyle[13]="Italic"; ReplaceFontStyle[13]="56 Italic";
                    FindAppliedParagraphStyle[14]="TableLegend"; FindAppliedFont[14]="Helvetica Neue LT Std"; FindAppliedFontStyle[14]="Regular"; ReplaceFontStyle[14]="55 Roman";
                    FindAppliedParagraphStyle[15]="Table_Body"; FindAppliedFont[15]="Helvetica Neue LT Std"; FindAppliedFontStyle[15]="Italic"; ReplaceFontStyle[15]="56 Italic";
                    FindAppliedParagraphStyle[16]="Table_Body"; FindAppliedFont[16]="Helvetica Neue LT Std"; FindAppliedFontStyle[16]="Regular"; ReplaceFontStyle[16]="55 Roman";
                    //NOTE: new entries can be added by simply adding a new line at the end that follows the pattern laid out above
                    //loop through all the find/replaces above
                    for (i = 0; i < FindAppliedParagraphStyle.length; i++) {
                         //test to see if there are missing fonts. 
                         try {fontLocs = app.activeDocument.fonts.everyItem().location; 
                         //if not, break.
                         app.findTextPreferences = null;     app.changeTextPreferences = null; alert("All missing fonts have been corrected."); break} 
                         //if so, try to correct by running find/replaces with the criteria above.     
                         catch (err) {
                              //clear find/change preferences
                              app.findTextPreferences = null;     app.changeTextPreferences = null;
                              //find and replace missing fonts based on the search criteria in the array
                              app.findTextPreferences.appliedFont=FindAppliedFont[i]+"     "+FindAppliedFontStyle[i]
                    //if all searches have been run and there are still missing fonts, alert the user
                    if (i==FindAppliedParagraphStyle.length) 
                    app.findTextPreferences = null;     app.changeTextPreferences = null; 
                    alert("There are still missing fonts. Go to Type > Find Font to find them.");