Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Alert Missing Fonts

Enthusiast ,
May 19, 2015 May 19, 2015

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
1.4K
Translate
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

Community Expert , May 20, 2015 May 20, 2015

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

Translate
Adobe
Community Expert ,
May 20, 2015 May 20, 2015

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

Translate
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

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

Translate
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
Community Expert ,
May 20, 2015 May 20, 2015

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

Translate
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
Community Expert ,
May 20, 2015 May 20, 2015

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

Translate
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

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

Translate
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
Community Beginner ,
Nov 21, 2021 Nov 21, 2021

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

Translate
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
Guide ,
Nov 22, 2021 Nov 22, 2021
LATEST
Translate
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