Skip to main content
Inspiring
March 23, 2015
Question

Get Postscript Name of used Fonts in Document

  • March 23, 2015
  • 1 reply
  • 1646 views

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

This topic has been closed for replies.

1 reply

Vamitul
Legend
March 23, 2015

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.

Sudha_KAuthor
Inspiring
March 24, 2015

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.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