function getFntsLst (doc){
var xmlString = new XML(doc.XMPString);
var fntFamily = xmlString.descendants("stFnt:fontFamily");
var fntFace = xmlString.descendants("stFnt:fontFace");
var fntFile = xmlString.descendants("stFnt:fontFileName");
var lst = new Array();
for (var i=0; i<fntFace.length(); i++)
lst.push([fntFamily, fntFace, fntFile]);
return lst;
}
function main() {
var dc = app.activeDocument;
var dcPth = dc.path;
var lst = getFntsLst (dc);
var dst = new Folder(dcPth + '/DocumentFonts');
var getFnts = function (string, dst) {
var tb = String.fromCharCode(9);
var lst = string.split(',');
var pth, fl, nm;
for (var i=0; i<lst.length; i++){
pth = app.fonts.itemByName(lst+tb+lst[++i]).location;
fl = File(pth);
nm = dst + '/' + lst[++i];
fl.copy(File(nm));
}
};
if (!dst.exists) dst.create();
var bt;
bt = new BridgeTalk();
bt.target = "indesign";
bt.body = getFnts.toSource() + '("' + lst +'", "' + dst.path+'/'+dst.name + '")';
bt.onResult = function (resultMsg) {
$.writeln("Result = " + resultMsg.body);
}
bt.onError = function (errorMsg) {
$.writeln("Error = " + errorMsg.body);
}
bt.send();
}
main();