Skip to main content
bastieneichenberger
Inspiring
February 20, 2015
Question

check missing font do not work

  • February 20, 2015
  • 1 reply
  • 832 views

Hi all,

I have some troubles to check if a font is correcty installed. I'm writting a script who use the property character.appliedFont.location.

1) I would like to check if the fonts in the document are correcty installed (The fonts are installed in the document only -> a folder Document fonts with a package).

- But if I check each font in the document -> every font is installed

- Then if I would like to use my property from a textframe object I figure it out that the font isn't installed

I do not understand why the result of font.status is different when I called it from a textframe?

if (document === undefined) {

   var document = app.activeDocument;

}

var fonts = document.fonts.everyItem().getElements();

for(var i = 0; i < fonts.length; i++){

   if(fonts[i].status !== FontStatus.INSTALLED) {

   //return true;
   alert('no font are uninstalled');

  }

}

var textframes = document.pages[0].textFrames;

/**
* @todo ask why this function do not work!!!
*/
for (var i = 0; i < textframes.length; i++) {

   if (textframes[i].characters[0].appliedFont.status !== FontStatus.INSTALLED) {

   alert('every textframe font are unavailable');

  }

}

return false;

I advance, thank you for the reply

Best regards.

This topic has been closed for replies.

1 reply

Community Expert
April 17, 2019

Hi bastieneichenberger ,

this is an old thread and you may have found what the issue is behind your checks with status !== FontStatus.INSTALLED .

Just did some tests with InDesign CC 2019 on Windows 10.

For the same used font in my document:

app.documents[0].fonts[0].status == FontStatus.INSTALLED // returns true

app.selection[0].characters[0].appliedFont.getElements()[0].status ==  FontStatus.NOT_AVAILABLE // returns true

What's going on here?

The font is available only through the Document fonts folder.

Expected:

app.fonts cannot see this font.

Install the font through e.g. InDesign's Fonts folder in the Application folder and check again:

The value of status is changing to FontStatus.INSTALLED for all three tests:

app.fonts ,

app.documents[0].fonts

app.selection[0].appliedFont

Regards,
Uwe

bastieneichenberger
Inspiring
April 23, 2019

Hi Laubender​,

Thanks a lot for your message!
I'll check this ASAP.

Best,

Bastien