17 Replies Latest reply on Jun 13, 2017 6:50 AM by Mikie9

    Issue with missing font code

    mikeb41294032

      Can someone please help with the code below??

       

      I am using this code to detect missing fonts as part of a script that exports pdfs.

       

      The issue is but not on every document it will error thinking there is a missing font, but when I go under the Type/Find Font/Fonts in document all is good.

      I can even do a direct pdf export out of InDesign without any issues and the fonts are fine in the pdf.

       

      I am not a scripter so can someone please look and see if there's a bug in this code?? also what would it take to check within the document bounds and not look at any text frames on the pasteboard?

       

      Maybe there is a better option for checking for missing fonts than what I am using.

       

       

      Thanks in advance!

       

       

      var usedFonts = app.activeDocument.fonts;

      var missingItem = '\n'

       

       

      for(var i = 0; i < usedFonts.length; i++){

          if(usedFonts[i].status != FontStatus.INSTALLED){

              missingItem += '\n' + usedFonts[i].fontFamily;

         alert('Document Contains Missing Fonts Job Aborted!')

                       exit();

                  }

              }