Somebody posted a question about how to write a script listing all fonts with details.
But while I was writing the script the post has gone. (How could this happen? )
Here is the script — it writes a list of all fonts available to InDesign and their details: name, full path to the font, type and version.
Kasyan
//-----------------------------------------
var myFonts = app.fonts.everyItem().getElements();
var myList = [];
for (i = 0; i < myFonts.length; i++) {
var myFont = myFonts[i];
myList.push("Name - " + myFont.fullName);
myList.push("Path - " + myFont.location);
myList.push("Type - " + GetFontType(myFont));
myList.push("Version - " + myFont.version);
myList.push("-----------------------");
}
WriteToFile(myList.join("\r"));
alert("Done");
function GetFontType(myFont) {
switch(myFont.fontType) {
case FontTypes.TYPE_1:
return "Type 1";
case FontTypes.TRUETYPE:
return "TrueType";
case FontTypes.CID:
return "CID";
case FontTypes.ATC:
return "ATC";
case FontTypes.BITMAP:
return "Bitmap";
case FontTypes.OCF:
return "OCF";
case FontTypes.OPENTYPE_CFF:
return "OpenType CFF";
case FontTypes.OPENTYPE_CID:
return "OpenType CID";
case FontTypes.BITMAP:
return "Bitmap";
case FontTypes.OPENTYPE_TT:
return "OpenType TT";
case FontTypes.UNKNOWN:
return "The font type is unknown";
default:
return "The font type is unknown";
}
}
function WriteToFile(myText){
myFile = new File("~/Desktop/List of fonts.txt");
myFile.open("w");
myFile.write(myText);
myFile.close();
}