2 Replies Latest reply on Mar 23, 2015 7:22 PM by Sudha K

    Get Postscript Name of used Fonts in Document

    Sudha K Level 1

      Hi,

       

          I need to get postscript font name of fonts used in InDesign Document.  Document Contains both text font and graphic fonts. When I am using the below code its returning text fonts used in document with "MT-Extra" font but "MT-Extra" font is showing as graphic. This line of code is returning text font with "MT-Extra" alone but other graphic fonts are missing. 

       

      alert("Fonts Used in Doc \n" + app.activeDocument.fonts.everyItem().postscriptName)

       

      How can I get all fonts (both text and graphic fonts) name using scripting.  Can anyone help me.

       

       

      Thanks in advance,

      Sudha K

        • 1. Re: Get Postscript Name of used Fonts in Document
          Vamitul Level 4

          If by "graphic fonts" you mean fonts inside linked graphics... there are ways of doing it, but not easy.

          One way would be to first embed the graphics inside the indesign document. Then alert("Fonts Used in Doc \n" + app.activeDocument.fonts.everyItem().postscriptName) should give them to you.

          Another, more safe but convoluted way would be to use BridgeTalk to open each linked file in the appropriate application (illustrator or photoshop) and use that to report back to the main script all the font details you need.

          • 2. Re: Get Postscript Name of used Fonts in Document
            Sudha K Level 1

            Hi,

             

             

               If i use this code alert("Fonts Used in Doc \n" + app.activeDocument.fonts.everyItem().postscriptName) its not returning all graphics fonts.


               Also, list of result fonts name is getting differ by using the below codes don't know why.


            alert(getFonts());

             

            Method 1:


            alert("Fonts Used in Doc \n" + app.activeDocument.fonts.everyItem().postscriptName)

             

            Method 2 :

             

            function getFonts()

            {

                var usedFonts = [];

                var usedFontsStr = "";   

                var docFonts = app.activeDocument.fonts;

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

                {

                    var psFontName = docFonts[i].postscriptName;

                    usedFontsStr = "#" + usedFonts.join("#")  + "#";

                    if(usedFontsStr.match("#"+ psFontName+"#") == null)

                    {

                        usedFonts.push(psFontName);usedFontsStr = "#" + usedFonts.join("#")  + "#";

                     }

                }

                return usedFonts;

            }

             

            Method 1 would return fonts used in document know then why this variation.

             

             

            - Sudha K