This website contains various projects I have worked on. Currently, this includes JavaScripts for Adobe applications and general production tutorials using Adobe Creative Suite applications. All projects can be accessed from the right-hand menu.

image of a notepad
Creating a report on fonts used in your InDesign document

Script Description

This script will create a report on all the fonts used in an InDesign document. For each font in use, it will list it's name, the family it belongs to, the version number, the font type, and whether it is installed or missing.

Looking at the Script

The script starts out by creating string that will contain all of the contents of the report. The variable “myFonts” is an array that holds all the references to the fonts used in the document.

myDocument = app.activeDocument;
myFonts = myDocument.fonts;
myDocumentName = "untitled";

try {
	myDocumentName = myDocument.name;
	}
	catch(e){}

myString = ("Font report for: " + myDocumentName + "\r\n");
myString = myString + ("Number of fonts used: " + myFonts.length + "\r\n");
      

Next the script goes through a loop for each font used. It finds properties of the font and adds the information to the string variable we created earlier. Some of the font properties are number codes that need to be translated to their meaning, for example a font type property of “1718899796” means the font is a TrueType font. All of these codes are listed in the help menu of the ExtendScript toolkit under the InDesign object Model.

    for (i = 0; i < myFonts.length; i++)
{
    myFont = myFonts[i];		
    myString = myString + ("Font name: " +  myFont.name + "\r");
    myString = myString + ("Font family: " + myFont.fontFamily + "\r");
    myString = myString + ("Version: " + myFont.version + "\r");
    
    //Check the font type
    if (myFont.fontType == "1718899796")
        {myType = "TrueType";	}
        else if (myFont.fontType == "1718899761")
            {myType = "Type 1";}
            else if (myFont.fontType == "1718898516")
                {myType = "OpenType TT";}
                else if (myFont.fontType == "1718898505")
                    {myType = "OpenType CID";}
                    else if (myFont.fontType == "1718895209")
                        {myType = "Bitmap";}
                        else {myType = "Unknown";}
    
    myString = myString + ("Font type: " + myType + "\r");					
    
    //Check the font status
    if (myFont.status == "1718831470")
        {myStatus = "Installed";}
            else{myStatus = "Missing";}
                
    myString = myString + ("Font status: " + myStatus + "\r");	
    myString =  myString + ("\r" + "---------------------------" + "\r\r");	
    }
        

Finally the script creates a new document with a textframe to paste the string we just created into. And that's the report. There were several other font properties that I didn't use, but could have been listed in this report. Some of the properties I ommitted were: whether the font can be printed, or embedded in a PDF, wether the font can be converted into outlines, and the path to the where the font resides on your computer

//Create a new document and textframe to display the report
myNewDoc = app.documents.add();
myNewTextFrame = myNewDoc.pages[0].textFrames.add(); 
myNewTextFrame.contents = myString;
myNewTextFrame.geometricBounds = [0,0,60,55];
myNewTextFrame.fit(FitOptions.FRAME_TO_CONTENT);

back to top

Image of a notepad

Table-of-Contents

Downloads


Other Projects:

Adobe JavaScripts ↑↓

Adobe Creative Suite Tutorials ↑↓