Alert Missing Fonts

Enthusiast ,
May 19, 2015 May 19, 2015

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

TOPICS
Scripting

Views

824

Likes

Translate

Translate

Report

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

correct answers 1 Correct answer

Adobe Community Professional , May 20, 2015 May 20, 2015
Here is a reference thread:https://forums.adobe.com/thread/1075283However, We can predefine and save  textFonts. When you need to check fonts, Read it and compare Documents font list.Ten

Likes

Translate

Translate
Adobe Community Professional ,
May 20, 2015 May 20, 2015

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);

スクリーンショット 2015-05-20 16.35.00.png

Documents font information in XMP string and System fonts list in textFonts property under the application.

Ten

Likes

Translate

Translate

Report

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
Enthusiast ,
May 20, 2015 May 20, 2015

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:

Screen Shot 2015-05-20 at 3.27.38 PM.png

Please look at Document Find Font Screenshot:

Screen Shot 2015-05-20 at 3.27.09 PM.png

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
May 20, 2015 May 20, 2015

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

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
May 20, 2015 May 20, 2015

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

Likes

Translate

Translate

Report

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
Enthusiast ,
May 20, 2015 May 20, 2015

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

Likes

Translate

Translate

Report

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
New Here ,
Nov 21, 2021 Nov 21, 2021

Copy link to clipboard

Copied

Hey, can someone post the solution here? The reference thread no longer exists.

Likes

Translate

Translate

Report

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
Advocate ,
Nov 22, 2021 Nov 22, 2021

Copy link to clipboard

Copied

LATEST

Likes

Translate

Translate

Report

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