Copy link to clipboard
Copied
Hi All,
FYI., new to Illustrator & Illustrator scripting.
Request:
Need alert, if the illustrator document having missing fonts.
In Indesign, we should use the below code:
Missing_Font();
function Missing_Font()
{
var myUsedFonts = app.activeDocument.fonts;
for (var i = 0; i < myUsedFonts.length; i++) {
if (myUsedFonts.status != "1718831470")
{
alert("Please Fix Missing Font")
exit(0);
}
}
}
Thanks in advance
Siraj
Here is a reference thread:
https://forums.adobe.com/thread/1075283
However, We can predefine and save textFonts. When you need to check fonts, Read it and compare Documents font list.
Ten
Copy link to clipboard
Copied
Here is a verify document<->system fonts sample code.
function getSysFonts(){
var f = app.textFonts;
var fontLst = [];
for (var i=0;i<f.length;i++){
fontLst.push(app.textFonts.name);
}
return fontLst.join(";");
}
function getFntsLst (doc){
var xmlString = new XML(doc.XMPString);
var fntFace = xmlString.descendants("stFnt:fontName");
var lst = [];
for (var i=0; i<fntFace.length(); i++)
lst.push(fntFace);
return lst;
}
var st="";
var ft = getFntsLst (app.activeDocument);
var sysFt = getSysFonts();
for (var i=0;i<ft.length;i++) {
if (sysFt.indexOf(ft)>-1) st += ft + " : found in system.\n";
else st += ft + " : not found in system.\n";
}
alert (st);
Documents font information in XMP string and System fonts list in textFonts property under the application.
Ten
Copy link to clipboard
Copied
Hi Ten,
Thanks for your quick response...
My request is,
if the document having any missing fonts, then the script should alert("Document having missing fonts. Please check")
I tried your script, it will list out all the used fonts only. Not shows missing font.
Script Output Screenshot:
Please look at Document Find Font Screenshot:
Copy link to clipboard
Copied
mmmm....
Sorry, I think textFonts property not contain missings, But I its wrong.
There seems to not in useful properties in AI.
I'll search another way to detect it...
Ten
Copy link to clipboard
Copied
Here is a reference thread:
https://forums.adobe.com/thread/1075283
However, We can predefine and save textFonts. When you need to check fonts, Read it and compare Documents font list.
Ten
Copy link to clipboard
Copied
Hi Ten,
Thanks a lot!!!!
No words to say, you did a excellent job for me.
Tested in single file, Works like a charm.
Even though, I need to check with all live jobs.
Again Thanks
Siraj
Copy link to clipboard
Copied
Hey, can someone post the solution here? The reference thread no longer exists.
Copy link to clipboard
Copied
This is the missing link:
https://web.archive.org/web/20141209030707/https://forums.adobe.com/thread/1075283