Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get Postscript Name of used Fonts in Document

Contributor ,
Mar 22, 2015 Mar 22, 2015

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

TOPICS
Scripting
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Mar 23, 2015 Mar 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Mar 23, 2015 Mar 23, 2015
LATEST

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines